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:
Daniel Gibson 2019-01-06 03:51:36 +01:00
parent efd814a4e0
commit fa363ab5ef
2 changed files with 16 additions and 2 deletions

View file

@ -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();
}
}
}

View file

@ -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());
}