for (s=fs_searchpaths ; s ; s=s->next)
{
if (s->pack)
- {
Con_Printf("%s (%i files)\n", s->pack->filename, s->pack->numfiles);
- }
else
Con_Printf("%s\n", s->filename);
}
{
if (matchpattern(current->text, "*.pak", true))
{
- dpsnprintf (pakfile, sizeof (pakfile), "%s/%s", dir, current->text);
+ dpsnprintf (pakfile, sizeof (pakfile), "%s%s", dir, current->text);
pak = FS_LoadPackPAK (pakfile);
if (pak)
{
{
if (matchpattern(current->text, "*.pk3", true))
{
- dpsnprintf (pakfile, sizeof (pakfile), "%s/%s", dir, current->text);
+ dpsnprintf (pakfile, sizeof (pakfile), "%s%s", dir, current->text);
pak = FS_LoadPackPK3 (pakfile);
if (pak)
{
#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
homedir = getenv ("HOME");
if (homedir != NULL && homedir[0] != '\0')
- FS_AddGameDirectory (va("%s/.%s/%s", homedir, gameuserdirname, dir));
+ FS_AddGameDirectory (va("%s/.%s/%s/", homedir, gameuserdirname, dir));
#endif
}
else
{
char netpath[MAX_OSPATH];
- dpsnprintf(netpath, sizeof(netpath), "%s/%s", search->filename, name);
+ dpsnprintf(netpath, sizeof(netpath), "%s%s", search->filename, name);
if (FS_SysFileExists (netpath))
{
if (!quiet)
if (pack_ind < 0)
{
char path [MAX_OSPATH];
- dpsnprintf (path, sizeof (path), "%s/%s", search->filename, filename);
+ dpsnprintf (path, sizeof (path), "%s%s", search->filename, filename);
return FS_SysOpen (path, "rb", nonblocking);
}
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);
char netpath[MAX_OSPATH];
char temp[MAX_OSPATH];
- while(!strncmp(pattern, "./", 2))
- pattern += 2;
- while(!strncmp(pattern, ".\\", 2))
- pattern += 2;
+ for (i = 0;pattern[i] == '.' || pattern[i] == ':' || pattern[i] == '/' || pattern[i] == '\\';i++)
+ ;
+
+ if (i > 0)
+ {
+ Con_Printf("Don't use punctuation at the beginning of a search pattern!\n");
+ return NULL;
+ }
search = NULL;
liststart = NULL;
slash = strrchr(pattern, '/');
backslash = strrchr(pattern, '\\');
colon = strrchr(pattern, ':');
- separator = pattern;
- if (separator < slash)
- separator = slash;
- if (separator < backslash)
- separator = backslash;
- if (separator < colon)
- separator = colon;
- basepathlength = separator - pattern;
+ separator = max(slash, backslash);
+ separator = max(separator, colon);
+ basepathlength = separator ? (separator + 1 - pattern) : 0;
basepath = Mem_Alloc (tempmempool, basepathlength + 1);
if (basepathlength)
memcpy(basepath, pattern, basepathlength);
else
{
// get a directory listing and look at each name
- dpsnprintf(netpath, sizeof (netpath), "%s/%s", searchpath->filename, basepath);
+ dpsnprintf(netpath, sizeof (netpath), "%s%s", searchpath->filename, basepath);
if ((dir = listdirectory(netpath)))
{
for (dirfile = dir;dirfile;dirfile = dirfile->next)
{
- dpsnprintf(temp, sizeof(temp), "%s/%s", basepath, dirfile->text);
+ dpsnprintf(temp, sizeof(temp), "%s%s", basepath, dirfile->text);
if (matchpattern(temp, (char *)pattern, true))
{
for (listtemp = liststart;listtemp;listtemp = listtemp->next)