summaryrefslogtreecommitdiff
path: root/filesystem-win.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-17 18:12:33 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-17 18:12:33 -0500
commit14811a586d77ab9a1fa8bef360250992aead55d1 (patch)
tree2fab3e9d4140cfee65faea369d84a5f9e9566cda /filesystem-win.c
parente719b02111d63aee561684d50e5fceaf1d099826 (diff)
started process-win.c
Diffstat (limited to 'filesystem-win.c')
-rw-r--r--filesystem-win.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/filesystem-win.c b/filesystem-win.c
index 8d7a95a..c6c64dd 100644
--- a/filesystem-win.c
+++ b/filesystem-win.c
@@ -1,6 +1,7 @@
#include "filesystem.h"
#include <sys/types.h>
#include <sys/stat.h>
+#include <io.h>
FsType fs_path_type(char const *path) {
struct _stat statbuf = {0};
@@ -13,7 +14,12 @@ FsType fs_path_type(char const *path) {
return FS_OTHER;
}
-#error "TODO: fs_path_permission"
+FsPermission fs_path_permission(char const *path) {
+ FsPermission permission = 0;
+ if (_access(path, 04) == 0) permission |= FS_PERMISSION_READ;
+ if (_access(path, 02) == 0) permission |= FS_PERMISSION_WRITE;
+ return permission;
+}
bool fs_file_exists(char const *path) {
return fs_path_type(path) == FS_FILE;