From: divverent Date: Tue, 8 Jan 2008 09:30:48 +0000 (+0000) Subject: new options: X-Git-Tag: xonotic-v0.1.0preview~2572 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=afdf35af0fded77251832765b1ce96fb875ca64e;p=xonotic%2Fdarkplaces.git new options: -appdata (Windows) -nohome (Linux) -userdir /path/to/userdir/to/be/used/instead/of/home/username/.darkplaces git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7934 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/fs.c b/fs.c index d37537a8..759f29e3 100644 --- a/fs.c +++ b/fs.c @@ -1012,19 +1012,36 @@ FS_AddGameHierarchy */ void FS_AddGameHierarchy (const char *dir) { -#ifndef WIN32 + int i; const char *homedir; -#endif + char userdir[MAX_QPATH]; // Add the common game directory FS_AddGameDirectory (va("%s%s/", fs_basedir, dir)); -#ifndef WIN32 + *userdir = 0; + // Add the personal game directory +#ifdef WIN32 + homedir = getenv ("APPDATA"); + dpsnprintf(userdir, sizeof(userdir), "%s/%s/", homedir, gameuserdirname); +#else homedir = getenv ("HOME"); - if (homedir != NULL && homedir[0] != '\0') - FS_AddGameDirectory (va("%s/.%s/%s/", homedir, gameuserdirname, dir)); + dpsnprintf(userdir, sizeof(userdir), "%s/.%s/", homedir, gameuserdirname); #endif + +#ifdef WIN32 + if(!COM_CheckParm("-appdata")) // TODO make this the default when fs_basedir isn't writable +#else + if(COM_CheckParm("-nohome")) +#endif + *userdir = 0; + + if((i = COM_CheckParm("-userdir")) && i < com_argc - 1) + dpsnprintf(userdir, sizeof(userdir), "%s/", com_argv[i+1]); + + if (*userdir) + FS_AddGameDirectory(va("%s%s/", userdir, dir)); }