mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-01-31 13:40:38 +00:00
Overhaul the *nix based BASE path
Try BUILD_DATADIR first (build time setting), then the vanilla doom3 path.
This commit is contained in:
parent
b242041319
commit
3e9545fb71
2 changed files with 13 additions and 22 deletions
|
@ -90,7 +90,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#define WIN32_CONSOLE_CLASS "dhewm 3 WinConsole"
|
#define WIN32_CONSOLE_CLASS "dhewm 3 WinConsole"
|
||||||
|
|
||||||
// Linux info
|
// Linux info
|
||||||
#define LINUX_DEFAULT_PATH "/usr/local/games/dhewm3"
|
#define LINUX_DEFAULT_PATH "/usr/local/games/doom3"
|
||||||
|
|
||||||
// CD Key file info
|
// CD Key file info
|
||||||
// goes into BASE_GAMEDIR whatever the fs_game is set to
|
// goes into BASE_GAMEDIR whatever the fs_game is set to
|
||||||
|
|
|
@ -55,31 +55,22 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case PATH_BASE:
|
case PATH_BASE:
|
||||||
if (Sys_GetPath(PATH_EXE, path)) {
|
if (stat(BUILD_DATADIR, &st) != -1 && S_ISDIR(st.st_mode)) {
|
||||||
path.StripFilename();
|
path = BUILD_DATADIR;
|
||||||
idStr::snPrintf(buf, sizeof(buf), "%s/" BASE_GAMEDIR, path.c_str());
|
return true;
|
||||||
if (stat(buf, &st) != -1 && S_ISDIR(st.st_mode)) {
|
|
||||||
path = buf;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
common->Printf("no '%s' directory in exe path %s, skipping\n", BASE_GAMEDIR, path.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s = Posix_Cwd();
|
common->Printf("WARNING: base path '" BUILD_DATADIR "' does not exits\n");
|
||||||
if (path != s) {
|
|
||||||
idStr::snPrintf(buf, sizeof(buf), "%s/" BASE_GAMEDIR, s);
|
// fallback to vanilla doom3 install
|
||||||
if (stat(buf, &st) != -1 && S_ISDIR(st.st_mode)) {
|
if (stat(LINUX_DEFAULT_PATH, &st) != -1 && S_ISDIR(st.st_mode)) {
|
||||||
path = buf;
|
common->Printf("WARNING: using hardcoded default base path\n");
|
||||||
return true;
|
|
||||||
} else {
|
path = LINUX_DEFAULT_PATH;
|
||||||
common->Printf("no '%s' directory in cwd path %s, skipping\n", BASE_GAMEDIR, s);
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
common->Printf("WARNING: using hardcoded default base path\n");
|
return false;
|
||||||
path = LINUX_DEFAULT_PATH;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case PATH_CONFIG:
|
case PATH_CONFIG:
|
||||||
s = getenv("XDG_CONFIG_HOME");
|
s = getenv("XDG_CONFIG_HOME");
|
||||||
|
|
Loading…
Reference in a new issue