From 5278b492751f31df81c297c60630b3106776b29e Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 1 May 2016 21:39:43 -0700 Subject: Removed assumptions that path separators are Unix style outside of Unix-only verions of functions --- util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'util.h') 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 -- cgit v1.2.3