From: havoc Date: Tue, 27 Dec 2005 09:56:31 +0000 (+0000) Subject: changed basedir and gamedir handling slightly to eliminate the need for "./" paths X-Git-Tag: xonotic-v0.1.0preview~4417 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f51eca19fe90459004c73a85439140378e41e57b;p=xonotic%2Fdarkplaces.git changed basedir and gamedir handling slightly to eliminate the need for "./" paths git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5870 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/fs.c b/fs.c index fd20cdc1..0b033104 100644 --- a/fs.c +++ b/fs.c @@ -894,7 +894,7 @@ void FS_AddGameHierarchy (const char *dir) #endif // Add the common game directory - FS_AddGameDirectory (va("%s/%s/", fs_basedir, dir)); + FS_AddGameDirectory (va("%s%s/", fs_basedir, dir)); #ifndef WIN32 // Add the personal game directory @@ -942,7 +942,7 @@ void FS_Init (void) fs_mempool = Mem_AllocPool("file management", 0, NULL); - strcpy(fs_basedir, "."); + strcpy(fs_basedir, ""); strcpy(fs_gamedir, ""); #ifdef MACOSX @@ -973,6 +973,10 @@ void FS_Init (void) fs_basedir[i-1] = 0; } + // add a path separator to the end of the basedir if it lacks one + if (fs_basedir[0] && fs_basedir[strlen(fs_basedir) - 1] != '/' && fs_basedir[strlen(fs_basedir) - 1] != '\\') + strlcat(fs_basedir, "/", sizeof(fs_basedir)); + // -path [] ... // Fully specifies the exact search path, overriding the generated one // COMMANDLINEOPTION: Filesystem: -path specifies the full search path manually, overriding the generated one, example: -path c:\quake\id1 c:\quake\pak0.pak c:\quake\pak1.pak (not recommended) @@ -1428,7 +1432,7 @@ qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboole char real_path [MAX_OSPATH]; // Open the file on disk directly - dpsnprintf (real_path, sizeof (real_path), "%s%s", fs_gamedir, filepath); + dpsnprintf (real_path, sizeof (real_path), "%s/%s", fs_gamedir, filepath); // Create directories up to the file FS_CreatePath (real_path);