mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-01-18 23:42:26 +00:00
On Linux/Unix, return EXE-path as base-path if BUILD_DATADIR fails
Using this path was the old behavior and is expected by many users.
This commit is contained in:
parent
768fdb5707
commit
6d9a43cb23
1 changed files with 11 additions and 0 deletions
|
@ -62,6 +62,17 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
|
|||
|
||||
common->Warning("base path '" BUILD_DATADIR "' does not exits");
|
||||
|
||||
// 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)) {
|
||||
common->Warning("using path of executable: %s", path.c_str());
|
||||
return true;
|
||||
} else {
|
||||
path.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// fallback to vanilla doom3 install
|
||||
if (stat(LINUX_DEFAULT_PATH, &st) != -1 && S_ISDIR(st.st_mode)) {
|
||||
common->Warning("using hardcoded default base path");
|
||||
|
|
Loading…
Reference in a new issue