summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-05-01 21:39:43 -0700
committerMichael Pavone <pavone@retrodev.com>2016-05-01 21:39:43 -0700
commit5278b492751f31df81c297c60630b3106776b29e (patch)
tree15586129807f0fa613c43aaa6c63c71efaf8a6eb /util.h
parentfc14e18db5375b0b8e081781c4c103c53da82add (diff)
Removed assumptions that path separators are Unix style outside of Unix-only verions of functions
Diffstat (limited to 'util.h')
-rw-r--r--util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.h b/util.h
index 7fd26b6..1cfaeda 100644
--- a/util.h
+++ b/util.h
@@ -9,6 +9,12 @@ typedef struct {
uint8_t is_dir;
} dir_entry;
+#ifdef _WIN32
+#define PATH_SEP "\\"
+#else
+#define PATH_SEP "/"
+#endif
+
//Utility functions
//Allocates a new string containing the concatenation of first and second
@@ -21,6 +27,10 @@ long file_size(FILE * f);
char * strip_ws(char * text);
//Inserts a null after the first word, returns a pointer to the second word
char * split_keyval(char * text);
+//Determines whether a character is a valid path separator for the current platform
+char is_path_sep(char c);
+//Determines whether a path is considered an absolute path on the current platform
+char is_absolute_path(char *path);
//Returns the basename of a path with th extension (if any) stripped
char * basename_no_extension(char *path);
//Gets the smallest power of two that is >= a certain value, won't work for values > 0x80000000