summaryrefslogtreecommitdiff
path: root/filesystem.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-19 12:11:00 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-19 12:11:00 -0500
commit3d86329abd754319a36459f8eb3e4bce6efffe1e (patch)
tree56f4e4ee82677221160c9e71f9efead0263ea852 /filesystem.h
parent84698e927b5324c8379897c1cbfd1667648a8af1 (diff)
show directories in a different color in open menu
Diffstat (limited to 'filesystem.h')
-rw-r--r--filesystem.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/filesystem.h b/filesystem.h
new file mode 100644
index 0000000..424b824
--- /dev/null
+++ b/filesystem.h
@@ -0,0 +1,26 @@
+#ifndef FILESYSTEM_H_
+#define FILESYSTEM_H_
+
+typedef enum {
+ FS_NON_EXISTENT,
+ FS_FILE,
+ FS_DIRECTORY,
+ FS_OTHER
+} FsType;
+
+// returns what kind of thing this is.
+FsType fs_path_type(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);
+// create the directory specified by `path`
+// returns:
+// 1 if the directory was created successfully
+// 0 if the directory already exists
+// -1 if the path already exists, but it's not a directory, or if there's another error (e.g. don't have permission to create directory).
+int fs_mkdir(char const *path);
+
+#endif // FILESYSTEM_H_ \ No newline at end of file