aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stdlib/paths.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c
index 83e480e1..7a4df182 100644
--- a/src/stdlib/paths.c
+++ b/src/stdlib/paths.c
@@ -226,21 +226,33 @@ public bool Path$can_read(Path_t path)
{
path = Path$expand_home(path);
const char *path_str = Path$as_c_string(path);
+#ifdef _GNU_SOURCE
return (euidaccess(path_str, R_OK) == 0);
+#else
+ return (access(path_str, R_OK) == 0);
+#endif
}
public bool Path$can_write(Path_t path)
{
path = Path$expand_home(path);
const char *path_str = Path$as_c_string(path);
+#ifdef _GNU_SOURCE
return (euidaccess(path_str, W_OK) == 0);
+#else
+ return (access(path_str, W_OK) == 0);
+#endif
}
public bool Path$can_execute(Path_t path)
{
path = Path$expand_home(path);
const char *path_str = Path$as_c_string(path);
+#ifdef _GNU_SOURCE
return (euidaccess(path_str, X_OK) == 0);
+#else
+ return (access(path_str, X_OK) == 0);
+#endif
}
public OptionalMoment_t Path$modified(Path_t path, bool follow_symlinks)