bool Sys_GetPath(sysPath_t type, idStr &path) { char buf[MAX_OSPATH]; struct _stat st; idStr s; switch(type) { case PATH_BASE: // try <path to exe>/base first if (Sys_GetPath(PATH_EXE, path)) { path.StripFilename(); s = path; s.AppendPath(BASE_GAMEDIR); if (_stat(s.c_str(), &st) != -1 && st.st_mode & _S_IFDIR) return true; common->Warning("base path '%s' does not exits", s.c_str()); } // fallback to vanilla doom3 cd install if (GetRegistryPath(buf, sizeof(buf), L"SOFTWARE\\id\\Doom 3", L"InstallPath") > 0) { path = buf; return true; } // fallback to steam doom3 install if (GetRegistryPath(buf, sizeof(buf), L"SOFTWARE\\Valve\\Steam", L"InstallPath") > 0) { path = buf; path.AppendPath("steamapps\\common\\doom 3"); if (_stat(path.c_str(), &st) != -1 && st.st_mode & _S_IFDIR) return true; } common->Warning("vanilla doom3 path not found"); return false; case PATH_CONFIG: case PATH_SAVE: if (GetHomeDir(buf, sizeof(buf)) < 1) { Sys_Error("ERROR: Couldn't get dir to home path"); return false; } path = buf; return true; case PATH_EXE: GetModuleFileName(NULL, buf, sizeof(buf) - 1); path = buf; path.BackSlashesToSlashes(); return true; } return false; }