X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=fs.c;h=58c5ed0a0ab763c3aca028185f94c3306c7b5e30;hb=c8faaabd182ae985281ec019f87ce7b7186b4ce9;hp=fd20cdc17a9b689c96817c4fa6fe98e278b533fa;hpb=7403ba135fe27515470bfc6a7f8980869ccfee76;p=xonotic%2Fdarkplaces.git
diff --git a/fs.c b/fs.c
index fd20cdc1..58c5ed0a 100644
--- a/fs.c
+++ b/fs.c
@@ -273,7 +273,7 @@ char fs_basedir[MAX_OSPATH];
qboolean fs_modified; // set true if using non-id files
-cvar_t scr_screenshot_name = {0, "scr_screenshot_name","dp"};
+cvar_t scr_screenshot_name = {0, "scr_screenshot_name","dp", "prefix name for saved screenshots (changes based on -game commandline, as well as which game mode is running)"};
/*
@@ -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)
@@ -1054,9 +1058,9 @@ void FS_Init_Commands(void)
{
Cvar_RegisterVariable (&scr_screenshot_name);
- Cmd_AddCommand ("path", FS_Path_f);
- Cmd_AddCommand ("dir", FS_Dir_f);
- Cmd_AddCommand ("ls", FS_Ls_f);
+ Cmd_AddCommand ("path", FS_Path_f, "print searchpath (game directories and archives)");
+ Cmd_AddCommand ("dir", FS_Dir_f, "list files in searchpath matching an * filename pattern, one per line");
+ Cmd_AddCommand ("ls", FS_Ls_f, "list files in searchpath matching an * filename pattern, multiple per line");
// set the default screenshot name to either the mod name or the
// gamemode screenshot name
@@ -1327,8 +1331,8 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet)
// Found it
if (!diff)
{
- if (!quiet)
- Con_DPrintf("FS_FindFile: %s in %s\n",
+ if (!quiet && developer.integer >= 10)
+ Con_Printf("FS_FindFile: %s in %s\n",
pak->files[middle].name, pak->filename);
if (index != NULL)
@@ -1349,8 +1353,8 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet)
dpsnprintf(netpath, sizeof(netpath), "%s%s", search->filename, name);
if (FS_SysFileExists (netpath))
{
- if (!quiet)
- Con_DPrintf("FS_FindFile: %s\n", netpath);
+ if (!quiet && developer.integer >= 10)
+ Con_Printf("FS_FindFile: %s\n", netpath);
if (index != NULL)
*index = -1;
@@ -1359,8 +1363,8 @@ static searchpath_t *FS_FindFile (const char *name, int* index, qboolean quiet)
}
}
- if (!quiet)
- Con_DPrintf("FS_FindFile: can't find %s\n", name);
+ if (!quiet && developer.integer >= 10)
+ Con_Printf("FS_FindFile: can't find %s\n", name);
if (index != NULL)
*index = -1;
@@ -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);