Files
bluelib/test/io/tree.c

33 lines
628 B
C
Raw Normal View History

#include <blue/io/directory.h>
#include <stdio.h>
#define NRAND_NUMBERS 12
#define NRAND_BYTES 128
#define NRAND_DOUBLES 8
int main(int argc, const char **argv)
{
if (argc < 2) {
return -1;
}
b_directory *dir = NULL;
b_path *path = b_path_create_from_cstr(argv[1]);
b_result result = b_directory_open(B_DIRECTORY_ROOT, path, 0, &dir);
if (b_result_is_error(result)) {
b_throw(result);
return -1;
}
2025-11-01 10:04:41 +00:00
b_iterator *it = b_directory_begin(dir, B_DIRECTORY_ITERATE_PARENT_FIRST);
b_foreach(b_directory_entry *, entry, it)
{
printf("%s\n", b_path_ptr(entry->filepath));
}
2025-11-01 10:04:41 +00:00
b_iterator_unref(it);
return 0;
}