From c20dbc7dac708f7a1fd33f668f45dfd8ae2709ca Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 30 Sep 2015 09:28:08 +0100 Subject: [PATCH] If SYSTEMWIDE, override the default basedir instead of adding a path This makes it behave a little more like -basedir in Quake 1 and fs_basepath in ioquake3. This lets "+set basedir" take precedence over the SYSTEMDIR, which is useful if you have the demo and full-game data installed in different base directories to be able to test the demo for regressions. --- src/common/filesystem.c | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/common/filesystem.c b/src/common/filesystem.c index ff06069d..e20c9d51 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -40,7 +40,7 @@ #ifdef SYSTEMWIDE #ifndef SYSTEMDIR - #define SYSTEMDIR "/usr/share/games/quake2/" + #define SYSTEMDIR "/usr/share/games/quake2" #endif #endif @@ -1381,25 +1381,6 @@ FS_AddHomeAsGameDirectory(char *dir) FS_AddGameDirectory(gdir); } -#ifdef SYSTEMWIDE -void -FS_AddSystemwideGameDirectory(char *dir) -{ - char gdir[MAX_OSPATH]; - char *datadir = SYSTEMDIR; - int len = snprintf(gdir, sizeof(gdir), "%s/%s/", datadir, dir); - - printf("Using %s to fetch paks\n", gdir); - - if ((len > 0) && (len < sizeof(gdir)) && (gdir[len - 1] == '/')) - { - gdir[len - 1] = 0; - } - - FS_AddGameDirectory(gdir); -} -#endif - void FS_AddBinaryDirAsGameDirectory(const char* dir) { char gdir[MAX_OSPATH]; @@ -1690,10 +1671,6 @@ FS_SetGamedir(char *dir) FS_AddGameDirectory(va("%s/%s", fs_cddir->string, dir)); } -#ifdef SYSTEMWIDE - FS_AddSystemwideGameDirectory(dir); -#endif - FS_AddGameDirectory(va("%s/%s", fs_basedir->string, dir)); FS_AddBinaryDirAsGameDirectory(dir); FS_AddHomeAsGameDirectory(dir); @@ -2081,7 +2058,13 @@ FS_InitFilesystem(void) Cmd_AddCommand("dir", FS_Dir_f); /* basedir Allows the game to run from outside the data tree. */ - fs_basedir = Cvar_Get("basedir", ".", CVAR_NOSET); + fs_basedir = Cvar_Get("basedir", +#ifdef SYSTEMWIDE + SYSTEMDIR, +#else + ".", +#endif + CVAR_NOSET); /* cddir Logically concatenates the cddir after the basedir to allow the game to run from outside the data tree. */ @@ -2101,10 +2084,6 @@ FS_InitFilesystem(void) /* Current directory. */ fs_homepath = Cvar_Get("homepath", Sys_GetCurrentDirectory(), CVAR_NOSET); -#ifdef SYSTEMWIDE - FS_AddSystemwideGameDirectory(BASEDIRNAME); -#endif - /* Add baseq2 to search path. */ FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string)); FS_AddBinaryDirAsGameDirectory(BASEDIRNAME);