io: add linux support

This commit is contained in:
2026-05-02 14:28:52 +01:00
parent cb39baa233
commit 4fcbcfdfb2
10 changed files with 1859 additions and 18 deletions
+6 -6
View File
@@ -123,7 +123,7 @@ struct fx_path *fx_path_create_from_cstr(const char *cstr)
prev = c;
}
while (fx_string_back(path->pathstr) == '/') {
while (fx_string_get_last_char(path->pathstr) == '/') {
fx_string_pop_back(path->pathstr);
}
@@ -138,8 +138,8 @@ static void append_path(struct fx_path *dest, const struct fx_path *src)
return;
}
if (fx_string_back(dest->pathstr) != '/'
&& fx_string_front(src->pathstr) != '/') {
if (fx_string_get_last_char(dest->pathstr) != '/'
&& fx_string_get_first_char(src->pathstr) != '/') {
char s[] = {'/', 0};
fx_string_append_cstr(dest->pathstr, s);
}
@@ -181,7 +181,7 @@ struct fx_path *fx_path_make_canonical(const struct fx_path *in)
bool fx_path_is_absolute(const struct fx_path *path)
{
const char *s = fx_string_ptr(path->pathstr);
const char *s = fx_string_get_cstr(path->pathstr);
size_t i;
for (i = 0; s[i]; i++) {
@@ -231,7 +231,7 @@ bool fx_path_is_directory(const struct fx_path *path)
const char *fx_path_ptr(const struct fx_path *path)
{
return fx_string_ptr(path->pathstr);
return fx_string_get_cstr(path->pathstr);
}
void path_release(struct fx_dsref* obj)
@@ -244,5 +244,5 @@ void path_to_string(struct fx_dsref* obj, struct fx_stringstream* out)
{
struct fx_path *path = (struct fx_path *)obj;
fx_stringstream_add(out, fx_string_ptr(path->pathstr));
fx_stringstream_add(out, fx_string_get_cstr(path->pathstr));
}