io: implement path manipulation and directory iteration on darwin
This commit is contained in:
@@ -20,6 +20,7 @@ typedef enum b_directory_iterator_flags {
|
||||
typedef struct b_directory_iterator {
|
||||
b_iterator _base;
|
||||
b_directory_iterator_flags flags;
|
||||
b_directory *root;
|
||||
char *filename;
|
||||
char *filepath;
|
||||
struct z__b_directory_iterator *_z;
|
||||
@@ -33,7 +34,8 @@ BLUE_API b_status b_directory_open(
|
||||
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_iterator_flags flags);
|
||||
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);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <blue/object/object.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define B_PATH(p) ((b_path *)p)
|
||||
|
||||
typedef struct b_path b_path;
|
||||
|
||||
BLUE_API b_path *b_path_create();
|
||||
@@ -25,8 +27,16 @@ 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 size_t b_path_length(const b_path *path);
|
||||
|
||||
BLUE_API b_path *b_path_retain(b_path *path);
|
||||
BLUE_API void b_path_release(b_path *path);
|
||||
static inline b_path *b_path_retain(b_path *path)
|
||||
{
|
||||
return B_PATH(b_retain(B_OBJECT(path)));
|
||||
}
|
||||
|
||||
static inline void b_path_release(b_path *path)
|
||||
{
|
||||
b_release(B_OBJECT(path));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user