io: implement pre- and post-order directory traversal for windows
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <blue/core/iterator.h>
|
||||
#include <blue/core/misc.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <blue/io/path.h>
|
||||
|
||||
#define B_DIRECTORY_ROOT ((b_directory *)NULL)
|
||||
|
||||
@@ -11,8 +12,14 @@ typedef struct b_directory b_directory;
|
||||
|
||||
struct z__b_directory_iterator;
|
||||
|
||||
typedef enum b_directory_iterator_flags {
|
||||
B_DIRECTORY_ITERATE_PARENT_FIRST = 0x01u,
|
||||
B_DIRECTORY_ITERATE_PARENT_LAST = 0x02u,
|
||||
} b_directory_iterator_flags;
|
||||
|
||||
typedef struct b_directory_iterator {
|
||||
b_iterator _base;
|
||||
b_directory_iterator_flags flags;
|
||||
char *filename;
|
||||
char *filepath;
|
||||
struct z__b_directory_iterator *_z;
|
||||
@@ -23,10 +30,10 @@ typedef struct b_directory_iterator {
|
||||
b_directory_iterator_is_valid(it); b_directory_iterator_next(it))
|
||||
|
||||
BLUE_API b_status b_directory_open(
|
||||
b_directory *root, const char *path, b_directory **out);
|
||||
b_directory *root, const b_path *path, b_directory **out);
|
||||
|
||||
BLUE_API int b_directory_iterator_begin(
|
||||
b_directory *directory, b_directory_iterator *it);
|
||||
b_directory *directory, b_directory_iterator *it, b_directory_iterator_flags flags);
|
||||
BLUE_API bool b_directory_iterator_next(b_directory_iterator *it);
|
||||
BLUE_API b_status b_directory_iterator_erase(b_directory_iterator *it);
|
||||
BLUE_API bool b_directory_iterator_is_valid(const b_directory_iterator *it);
|
||||
|
||||
@@ -24,6 +24,8 @@ BLUE_API bool b_path_exists(const b_path *path);
|
||||
BLUE_API bool b_path_is_file(const b_path *path);
|
||||
BLUE_API bool b_path_is_directory(const b_path *path);
|
||||
|
||||
BLUE_API const char *b_path_ptr(const b_path *path);
|
||||
|
||||
BLUE_API b_path *b_path_retain(b_path *path);
|
||||
BLUE_API void b_path_release(b_path *path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user