summaryrefslogtreecommitdiff
path: root/filesystem.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-04-13 12:29:32 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2021-04-13 12:29:32 -0400
commit69789c042460e012ec3054cc2e6ceeff25e394b9 (patch)
tree0bb6fcd54a4e0f85ba430a2e3e2c54af258d797d /filesystem.h
parent2007d299916be6b079e6b97aea7c4d2835e23bd0 (diff)
change fs_list_directory to include entry types directly
Diffstat (limited to 'filesystem.h')
-rw-r--r--filesystem.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/filesystem.h b/filesystem.h
index 6325bd7..be57323 100644
--- a/filesystem.h
+++ b/filesystem.h
@@ -14,15 +14,20 @@ enum {
};
typedef u8 FsPermission;
+typedef struct {
+ FsType type;
+ char name[];
+} FsDirectoryEntry;
+
// returns what kind of thing this is.
FsType fs_path_type(char const *path);
FsPermission fs_path_permission(char const *path);
// Does this file exist? Returns false for directories.
bool fs_file_exists(char const *path);
-// Returns a NULL-terminated array of the files/directories in this directory, or NULL if the directory does not exist.
-// When you're done with the file names, call free on each one, then on the array.
-// NOTE: The files aren't returned in any particular order!
-char **fs_list_directory(char const *dirname);
+// Returns a NULL-terminated array of the files/directories in this directory, or NULL if the directory does not exist/out of memory.
+// When you're done with the entries, call free on each one, then on the array.
+// NOTE: The files/directories aren't returned in any particular order!
+FsDirectoryEntry **fs_list_directory(char const *dirname);
// Create the directory specified by `path`
// Returns:
// 1 if the directory was created successfully