forked from mirrors/principia
Add fallback for Windows cache dir if LOCALAPPDATA is undefined
This commit is contained in:
parent
0922b84a69
commit
f75299ee8d
1 changed files with 5 additions and 1 deletions
|
|
@ -119,7 +119,11 @@ const char *tms_storage_cache_path(void)
|
||||||
snprintf(path, 1024, "%s/cache", SDL_GetBasePath());
|
snprintf(path, 1024, "%s/cache", SDL_GetBasePath());
|
||||||
} else { // System
|
} else { // System
|
||||||
#ifdef TMS_BACKEND_WINDOWS
|
#ifdef TMS_BACKEND_WINDOWS
|
||||||
snprintf(path, 1024, "%s\\Principia", getenv("LOCALAPPDATA"));
|
const char *localappdata = getenv("LOCALAPPDATA");
|
||||||
|
if (localappdata)
|
||||||
|
snprintf(path, 1024, "%s\\Principia", localappdata);
|
||||||
|
else // XP doesn't define LOCALAPPDATA, fallback to another dir in APPDATA
|
||||||
|
snprintf(path, 1024, "%s\\Principia_cache", getenv("APPDATA"));
|
||||||
#else
|
#else
|
||||||
const char *xdg = getenv("XDG_CACHE_HOME");
|
const char *xdg = getenv("XDG_CACHE_HOME");
|
||||||
if (!xdg)
|
if (!xdg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue