summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-04-15 18:29:39 -0700
committerMichael Pavone <pavone@retrodev.com>2016-04-15 18:29:39 -0700
commit470800d02a97ca852a37efe81e97af9e4a0e4a05 (patch)
tree9f0dd3cecca09efb77996ae2ed166e7aa600bb51 /util.h
parentdb0f3ca459cc270e8048c8e554c3051b4014de91 (diff)
Switch to storing SRAM/EEPROM and save states in a per-game directory rather than next to the ROM (for SRAM/EEPROM) or in the current working directory (for save states)
Diffstat (limited to 'util.h')
-rw-r--r--util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/util.h b/util.h
index c6eef76..b9d271e 100644
--- a/util.h
+++ b/util.h
@@ -20,6 +20,8 @@ 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);
+//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
uint32_t nearest_pow2(uint32_t val);
//Should be called by main with the value of argv[0] for use by get_exe_dir
@@ -30,12 +32,16 @@ char * get_exe_dir();
char * get_home_dir();
//Returns an appropriate path for storing config files
char const *get_config_dir();
+//Returns an appropriate path for saving non-config data like savestates
+char const *get_save_dir();
//Reads a file bundled with the executable
char *read_bundled_file(char *name, long *sizeret);
//Retunrs an array of normal files and directories residing in a directory
dir_entry *get_dir_list(char *path, size_t *numret);
//Frees a dir list returned by get_dir_list
void free_dir_list(dir_entry *list, size_t numentries);
+//Recusrively creates a directory if it does not exist
+int ensure_dir_exists(char *path);
//Returns the contents of a symlink in a newly allocated string
char * readlink_alloc(char * path);
//Prints an error message to stderr and to a message box if not in headless mode and then exits