diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-07 06:54:15 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-07 06:54:15 +0200 |
commit | b2f78fca337476513e4be2c9d9af8eee5f8080b4 (patch) | |
tree | 3b1412344fe2e0de803a0572fb72e3e4a421cf30 /src | |
parent | 81bf0db7770de632115b52232246d9e6c74de7b2 (diff) |
Windows: Check for a portable userdata directory
IssueID #120
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -224,6 +224,14 @@ static const char *dataDir_App_(void) { | |||
224 | return concatPath_CStr(configHome, "lagrange"); | 224 | return concatPath_CStr(configHome, "lagrange"); |
225 | } | 225 | } |
226 | #endif | 226 | #endif |
227 | #if defined (iPlatformMsys) | ||
228 | /* Check for a portable userdata directory. */ | ||
229 | iApp *d = &app_; | ||
230 | const char *userDir = concatPath_CStr(cstr_String(d->execPath), "..\\userdata"); | ||
231 | if (fileExistsCStr_FileInfo(userDir)) { | ||
232 | return userDir; | ||
233 | } | ||
234 | #endif | ||
227 | return defaultDataDir_App_; | 235 | return defaultDataDir_App_; |
228 | } | 236 | } |
229 | 237 | ||
@@ -381,10 +389,6 @@ static uint32_t checkAsleep_App_(uint32_t interval, void *param) { | |||
381 | #endif | 389 | #endif |
382 | 390 | ||
383 | static void init_App_(iApp *d, int argc, char **argv) { | 391 | static void init_App_(iApp *d, int argc, char **argv) { |
384 | const iBool isFirstRun = !fileExistsCStr_FileInfo(cleanedPath_CStr(dataDir_App_())); | ||
385 | d->isFinishedLaunching = iFalse; | ||
386 | d->launchCommands = new_StringList(); | ||
387 | iZap(d->lastDropTime); | ||
388 | init_CommandLine(&d->args, argc, argv); | 392 | init_CommandLine(&d->args, argc, argv); |
389 | /* Where was the app started from? We ask SDL first because the command line alone is | 393 | /* Where was the app started from? We ask SDL first because the command line alone is |
390 | not a reliable source of this information, particularly when it comes to different | 394 | not a reliable source of this information, particularly when it comes to different |
@@ -399,6 +403,10 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
399 | } | 403 | } |
400 | SDL_free(exec); | 404 | SDL_free(exec); |
401 | } | 405 | } |
406 | const iBool isFirstRun = !fileExistsCStr_FileInfo(cleanedPath_CStr(dataDir_App_())); | ||
407 | d->isFinishedLaunching = iFalse; | ||
408 | d->launchCommands = new_StringList(); | ||
409 | iZap(d->lastDropTime); | ||
402 | init_SortedArray(&d->tickers, sizeof(iTicker), cmp_Ticker_); | 410 | init_SortedArray(&d->tickers, sizeof(iTicker), cmp_Ticker_); |
403 | d->lastTickerTime = SDL_GetTicks(); | 411 | d->lastTickerTime = SDL_GetTicks(); |
404 | d->elapsedSinceLastTicker = 0; | 412 | d->elapsedSinceLastTicker = 0; |