mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-21 02:01:03 +00:00
Fallback to demo/ should work better now
i.e. also when not starting the game with +set fs_basepath /bla/
This commit is contained in:
parent
efd814a4e0
commit
fa363ab5ef
2 changed files with 16 additions and 2 deletions
|
@ -71,7 +71,13 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
|
|||
common->Warning("using path of executable: %s", path.c_str());
|
||||
return true;
|
||||
} else {
|
||||
path.Clear();
|
||||
idStr testPath = path + "/demo/demo00.pk4";
|
||||
if(stat(testPath.c_str(), &st) != -1 && S_ISREG(st.st_mode)) {
|
||||
common->Warning("using path of executable (seems to contain demo game data): %s", path.c_str());
|
||||
return true;
|
||||
} else {
|
||||
path.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,8 +340,16 @@ bool Sys_GetPath(sysPath_t type, idStr &path) {
|
|||
|
||||
s = path;
|
||||
s.AppendPath(BASE_GAMEDIR);
|
||||
if (_stat(s.c_str(), &st) != -1 && st.st_mode & _S_IFDIR)
|
||||
if (_stat(s.c_str(), &st) != -1 && (st.st_mode & _S_IFDIR)) {
|
||||
common->Warning("using path of executable: %s", path.c_str());
|
||||
return true;
|
||||
} else {
|
||||
s = path + "/demo/demo00.pk4";
|
||||
if (_stat(s.c_str(), &st) != -1 && (st.st_mode & _S_IFREG)) {
|
||||
common->Warning("using path of executable (seems to contain demo game data): %s ", path.c_str());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
common->Warning("base path '%s' does not exist", s.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue