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)"};
/*
#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
fs_mempool = Mem_AllocPool("file management", 0, NULL);
- strcpy(fs_basedir, ".");
+ strcpy(fs_basedir, "");
strcpy(fs_gamedir, "");
#ifdef MACOSX
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 <dir or packfile> [<dir or packfile>] ...
// Fully specifies the exact search path, overriding the generated one
// COMMANDLINEOPTION: Filesystem: -path <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)
{
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
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);
int FS_VPrintf (qfile_t* file, const char* format, va_list ap)
{
int len;
- fs_offset_t buff_size;
- char *tempbuff = NULL;
+ fs_offset_t buff_size = MAX_INPUTLINE;
+ char *tempbuff;
- buff_size = 1024;
- tempbuff = (char *)Mem_Alloc (tempmempool, buff_size);
- len = dpvsnprintf (tempbuff, buff_size, format, ap);
- while (len < 0)
+ for (;;)
{
- Mem_Free (tempbuff);
- buff_size *= 2;
tempbuff = (char *)Mem_Alloc (tempmempool, buff_size);
len = dpvsnprintf (tempbuff, buff_size, format, ap);
+ if (len >= 0 && len < buff_size)
+ break;
+ Mem_Free (tempbuff);
+ buff_size *= 2;
}
len = write (file->handle, tempbuff, len);
int linebufpos;
int i, j, k, l;
const char *name;
- char linebuf[4096];
+ char linebuf[MAX_INPUTLINE];
fssearch_t *search;
search = FS_Search(pattern, true, true);
if (!search)