diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-19 12:11:00 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-19 12:11:00 -0500 |
commit | 3d86329abd754319a36459f8eb3e4bce6efffe1e (patch) | |
tree | 56f4e4ee82677221160c9e71f9efead0263ea852 /filesystem-win.c | |
parent | 84698e927b5324c8379897c1cbfd1667648a8af1 (diff) |
show directories in a different color in open menu
Diffstat (limited to 'filesystem-win.c')
-rw-r--r-- | filesystem-win.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/filesystem-win.c b/filesystem-win.c index 25b8d95..7c40820 100644 --- a/filesystem-win.c +++ b/filesystem-win.c @@ -1,15 +1,23 @@ -// see filesystem-posix.c for function documentation +#include "filesystem.h" #include <sys/types.h> #include <sys/stat.h> -static bool fs_file_exists(char const *path) { +FsType fs_path_type(char const *path) { struct _stat statbuf = {0}; if (_stat(path, &statbuf) != 0) - return false; - return (statbuf.st_mode & _S_IFREG) != 0; + return FS_NON_EXISTENT; + if (statbuf.st_mode & _S_IFREG) + return FS_FILE; + if (statbuf.st_mode & _S_IFDIR) + return FS_DIRECTORY; + return FS_OTHER; } -static char **fs_list_directory(char const *dirname) { +bool fs_file_exists(char const *path) { + return fs_path_type(path) == FS_FILE; +} + +char **fs_list_directory(char const *dirname) { char file_pattern[256] = {0}; char **ret = NULL; WIN32_FIND_DATA find_data; @@ -46,7 +54,7 @@ static char **fs_list_directory(char const *dirname) { return ret; } -static int fs_mkdir(char const *path) { +int fs_mkdir(char const *path) { if (CreateDirectoryA(path, NULL)) { // directory created successfully return 1; |