diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-05-01 21:39:43 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-05-01 21:39:43 -0700 |
commit | 5278b492751f31df81c297c60630b3106776b29e (patch) | |
tree | 15586129807f0fa613c43aaa6c63c71efaf8a6eb /util.h | |
parent | fc14e18db5375b0b8e081781c4c103c53da82add (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.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 |