mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-21 18:21:08 +00:00
Linux: Fix fallback to look for gamedata in /usr/local/games/doom3/
Before checking there I look for gamedata next to the executable, but the check was broken: I got the directory the executable is in and checked if it exists.. well.. of course it does, but that doesn't mean there's game data in it.. So now I check if that directory actually has a "base/" subdirectory (or whatever is #defined in BASE_GAMEDIR) and if that fails /usr/local/games/doom3/ is tried instead. Thanks chungy for pointing the bug out in #97 !
This commit is contained in:
parent
6ba1b71fb1
commit
c333a46373
1 changed files with 4 additions and 2 deletions
|
@ -65,7 +65,9 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
|
|||
// try next to the executable..
|
||||
if (Sys_GetPath(PATH_EXE, path)) {
|
||||
path = path.StripFilename();
|
||||
if (stat(path.c_str(), &st) != -1 && S_ISDIR(st.st_mode)) {
|
||||
// the path should have a base dir in it, otherwise it probably just contains the executable
|
||||
idStr testPath = path + "/" BASE_GAMEDIR;
|
||||
if (stat(testPath.c_str(), &st) != -1 && S_ISDIR(st.st_mode)) {
|
||||
common->Warning("using path of executable: %s", path.c_str());
|
||||
return true;
|
||||
} else {
|
||||
|
@ -75,7 +77,7 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
|
|||
|
||||
// fallback to vanilla doom3 install
|
||||
if (stat(LINUX_DEFAULT_PATH, &st) != -1 && S_ISDIR(st.st_mode)) {
|
||||
common->Warning("using hardcoded default base path");
|
||||
common->Warning("using hardcoded default base path: " LINUX_DEFAULT_PATH);
|
||||
|
||||
path = LINUX_DEFAULT_PATH;
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue