Mercurial > repos > blastem
diff util.h @ 1008:51885857c019
Removed assumptions that path separators are Unix style outside of Unix-only verions of functions
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 May 2016 21:39:43 -0700 |
parents | 1618d3676a35 |
children | 22e87b739ad6 |
line wrap: on
line diff
--- a/util.h Sun May 01 17:43:28 2016 -0700 +++ b/util.h Sun May 01 21:39:43 2016 -0700 @@ -9,6 +9,12 @@ 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 @@ 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