io: store current directory iterator filepath as a b_path

This commit is contained in:
2025-02-13 21:36:53 +00:00
parent c822be0804
commit 8177eb2b24
4 changed files with 34 additions and 12 deletions

View File

@@ -166,14 +166,17 @@ struct b_path *b_path_join(
struct b_path *b_path_make_absolute(const struct b_path *in)
{
return NULL;
}
struct b_path *b_path_make_relative(const struct b_path *in)
{
return NULL;
}
struct b_path *b_path_make_canonical(const struct b_path *in)
{
return NULL;
}
bool b_path_is_absolute(const struct b_path *path)
@@ -202,17 +205,28 @@ bool b_path_is_absolute(const struct b_path *path)
bool b_path_exists(const struct b_path *path)
{
DWORD attrib = GetFileAttributesA(b_path_ptr(path));
return attrib != INVALID_FILE_ATTRIBUTES;
}
bool b_path_is_file(const struct b_path *path)
{
DWORD attrib = GetFileAttributesA(b_path_ptr(path));
if (attrib == INVALID_FILE_ATTRIBUTES) {
return false;
}
return (attrib & FILE_ATTRIBUTE_NORMAL) != 0;
}
bool b_path_is_directory(const struct b_path *path)
{
DWORD attrib = GetFileAttributesA(b_path_ptr(path));
if (attrib == INVALID_FILE_ATTRIBUTES) {
return false;
}
return (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
const char *b_path_ptr(const struct b_path *path)
@@ -220,17 +234,10 @@ const char *b_path_ptr(const struct b_path *path)
return b_string_ptr(path->pathstr);
}
struct b_path *b_path_retain(struct b_path *path)
{
}
void b_path_release(struct b_path *path)
{
}
void path_release(struct b_object* obj)
{
b_path_release((struct b_path *)obj);
struct b_path *path = B_PATH(obj);
b_string_release(path->pathstr);
}
void path_to_string(struct b_object* obj, struct b_stringstream* out)