fx.io: expand path joining functionality to non-path strings

This commit is contained in:
2026-06-20 15:25:16 +01:00
parent 32d4d0abf2
commit ee11ff240f
10 changed files with 239 additions and 151 deletions
+3 -3
View File
@@ -60,7 +60,7 @@ enum fx_status fx_directory_open(
}
HANDLE dir_handle = CreateFileA(
fx_path_ptr(new_path), GENERIC_READ,
fx_path_get_cstr(new_path), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE);
@@ -197,7 +197,7 @@ static bool move_into_directory(struct fx_directory_iterator *it, const char *di
state = push_iteration_state(it->_z);
state->search_path = dir_path;
state->search = FindFirstFileA(fx_path_ptr(search_path), &state->data);
state->search = FindFirstFileA(fx_path_get_cstr(search_path), &state->data);
fx_path_release(search_path);
fx_path_release(wildcard);
@@ -224,7 +224,7 @@ static bool move_into_directory(struct fx_directory_iterator *it, const char *di
static bool move_to_first_item(
struct fx_directory_iterator *it, const struct fx_path *root_dir)
{
bool has_results = move_into_directory(it, fx_path_ptr(root_dir));
bool has_results = move_into_directory(it, fx_path_get_cstr(root_dir));
if (!has_results) {
return false;
+4 -4
View File
@@ -205,13 +205,13 @@ bool fx_path_is_absolute(const struct fx_path *path)
bool fx_path_exists(const struct fx_path *path)
{
DWORD attrib = GetFileAttributesA(fx_path_ptr(path));
DWORD attrib = GetFileAttributesA(fx_path_get_cstr(path));
return attrib != INVALID_FILE_ATTRIBUTES;
}
bool fx_path_is_file(const struct fx_path *path)
{
DWORD attrib = GetFileAttributesA(fx_path_ptr(path));
DWORD attrib = GetFileAttributesA(fx_path_get_cstr(path));
if (attrib == INVALID_FILE_ATTRIBUTES) {
return false;
}
@@ -221,7 +221,7 @@ bool fx_path_is_file(const struct fx_path *path)
bool fx_path_is_directory(const struct fx_path *path)
{
DWORD attrib = GetFileAttributesA(fx_path_ptr(path));
DWORD attrib = GetFileAttributesA(fx_path_get_cstr(path));
if (attrib == INVALID_FILE_ATTRIBUTES) {
return false;
}
@@ -229,7 +229,7 @@ bool fx_path_is_directory(const struct fx_path *path)
return (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
const char *fx_path_ptr(const struct fx_path *path)
const char *fx_path_get_cstr(const struct fx_path *path)
{
return fx_string_get_cstr(path->pathstr);
}