Mercurial > repos > blastem
diff util.c @ 1295:96ad1b9bbb3a
Make save directory configurable. Satisfies ticket:4
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 21 Mar 2017 21:40:47 -0700 |
parents | 5905593d6828 |
children | 5ceb316c479a |
line wrap: on
line diff
--- a/util.c Tue Mar 21 19:56:50 2017 -0700 +++ b/util.c Tue Mar 21 21:40:47 2017 -0700 @@ -681,7 +681,7 @@ return SDL_AndroidGetInternalStoragePath(); } -char const *get_save_dir() +char const *get_userdata_dir() { return SDL_AndroidGetInternalStoragePath(); } @@ -729,7 +729,7 @@ #ifdef _WIN32 -char const *get_save_base_dir() +char const *get_userdata_dir() { static char path[MAX_PATH]; if (S_OK == SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path)) @@ -738,22 +738,24 @@ } return NULL; } + +char const *get_config_dir() +{ + return get_userdata_dir(); +} #define CONFIG_PREFIX "" #define SAVE_PREFIX "" #else -#define get_save_base_dir get_home_dir #define CONFIG_PREFIX "/.config" -#define SAVE_PREFIX "/.local/share" - -#endif +#define USERDATA_SUFFIX "/.local/share" char const *get_config_dir() { static char* confdir; if (!confdir) { - char const *base = get_save_base_dir(); + char const *base = get_home_dir(); if (base) { confdir = alloc_concat(base, CONFIG_PREFIX PATH_SEP "blastem"); } @@ -761,16 +763,21 @@ return confdir; } -char const *get_save_dir() +char const *get_userdata_dir() { static char* savedir; if (!savedir) { - char const *base = get_save_base_dir(); + char const *base = get_home_dir(); if (base) { - savedir = alloc_concat(base, SAVE_PREFIX PATH_SEP "blastem"); + savedir = alloc_concat(base, USERDATA_SUFFIX); } } return savedir; } + #endif + + + +#endif