TAISEI_RES_PATH and TAISEI_STORAGE_PATH env variables
override resources and storage paths, respectively
This commit is contained in:
parent
9293f4ba79
commit
fb9cee4043
1 changed files with 21 additions and 5 deletions
26
src/main.c
26
src/main.c
|
@ -100,15 +100,31 @@ static void init_sdl(void) {
|
|||
log_info("Using SDL %u.%u.%u", v.major, v.minor, v.patch);
|
||||
}
|
||||
|
||||
static void get_core_paths(char **res, char **storage) {
|
||||
static char* get_default_res_path(void) {
|
||||
char *res;
|
||||
|
||||
#ifdef RELATIVE
|
||||
*res = SDL_GetBasePath();
|
||||
strappend(res, "data/");
|
||||
res = SDL_GetBasePath();
|
||||
strappend(&res, "data/");
|
||||
#else
|
||||
*res = strdup(STATIC_RESOURCE_PREFIX);
|
||||
res = strdup(STATIC_RESOURCE_PREFIX);
|
||||
#endif
|
||||
|
||||
*storage = SDL_GetPrefPath("", "taisei");
|
||||
return res;
|
||||
}
|
||||
|
||||
static void get_core_paths(char **res, char **storage) {
|
||||
if((*res = getenv("TAISEI_RES_PATH")) && **res) {
|
||||
*res = strdup(*res);
|
||||
} else {
|
||||
*res = get_default_res_path();
|
||||
}
|
||||
|
||||
if((*storage = getenv("TAISEI_STORAGE_PATH")) && **storage) {
|
||||
*storage = strdup(*storage);
|
||||
} else {
|
||||
*storage = SDL_GetPrefPath("", "taisei");
|
||||
}
|
||||
}
|
||||
|
||||
static void init_vfs(bool silent) {
|
||||
|
|
Loading…
Reference in a new issue