]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
Remove FS_FIX_PATHS again and disable model rendering in the menu until someone can...
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index 60c89d2609cbe53c7dd201b5daf9d6e40aec355d..de596b4b9ccaa7227f42741bdbc7b034106da24c 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1020,7 +1020,6 @@ void FS_AddGameHierarchy (const char *dir)
 #ifdef WIN32
        if(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir) == S_OK)
                dpsnprintf(userdir, sizeof(userdir), "%s/My Games/%s/", mydocsdir, gameuserdirname);
-       fprintf(stderr, "userdir = %s\n", userdir);
 #else
        homedir = getenv ("HOME");
        if(homedir)
@@ -1041,7 +1040,7 @@ void FS_AddGameHierarchy (const char *dir)
 
        if(COM_CheckParm("-nohome"))
                *userdir = 0;
-       
+
        if((i = COM_CheckParm("-userdir")) && i < com_argc - 1)
                dpsnprintf(userdir, sizeof(userdir), "%s/", com_argv[i+1]);
 
@@ -1244,9 +1243,6 @@ qboolean FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qboolean
                }
        }
 
-       // halt demo playback to close the file
-       CL_Disconnect();
-
        Host_SaveConfig();
 
        fs_numgamedirs = numgamedirs;
@@ -1305,6 +1301,9 @@ void FS_GameDir_f (void)
                return;
        }
 
+       // halt demo playback to close the file
+       CL_Disconnect();
+
        FS_ChangeGameDirs(numgamedirs, gamedirs, true, true);
 }
 
@@ -1379,10 +1378,10 @@ void FS_Init (void)
                strlcat(fs_basedir, "/", sizeof(fs_basedir));
 
        if (!FS_CheckGameDir(gamedirname1))
-               Sys_Error("base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1);
+               Con_Printf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname1);
 
        if (gamedirname2 && !FS_CheckGameDir(gamedirname2))
-               Sys_Error("base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2);
+               Con_Printf("WARNING: base gamedir %s%s/ not found!\n", fs_basedir, gamedirname2);
 
        // -game <gamedir>
        // Adds basedir/gamedir as an override game
@@ -1397,7 +1396,7 @@ void FS_Init (void)
                        if (FS_CheckNastyPath(com_argv[i], true))
                                Sys_Error("-game %s%s/ is a dangerous/non-portable path\n", fs_basedir, com_argv[i]);
                        if (!FS_CheckGameDir(com_argv[i]))
-                               Sys_Error("-game %s%s/ not found!\n", fs_basedir, com_argv[i]);
+                               Con_Printf("WARNING: -game %s%s/ not found!\n", fs_basedir, com_argv[i]);
                        // add the gamedir to the list of active gamedirs
                        strlcpy (fs_gamedirs[fs_numgamedirs], com_argv[i], sizeof(fs_gamedirs[fs_numgamedirs]));
                        fs_numgamedirs++;
@@ -1809,17 +1808,6 @@ Open a file. The syntax is the same as fopen
 */
 qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking)
 {
-#ifdef FS_FIX_PATHS
-       char fixedFileName[MAX_QPATH];
-       char *d;
-       strlcpy( fixedFileName, filepath, MAX_QPATH );
-       // try to fix common mistakes (\ instead of /)
-       for( d = fixedFileName ; *d ; d++ )
-               if( *d == '\\' )
-                       *d = '/';
-       filepath = fixedFileName;
-#endif
-
        if (FS_CheckNastyPath(filepath, false))
        {
                Con_Printf("FS_Open(\"%s\", \"%s\", %s): nasty filename rejected\n", filepath, mode, quiet ? "true" : "false");
@@ -2629,25 +2617,25 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
                                if( !nextseparator ) {
                                        nextseparator = start + strlen( start );
                                }
-                               
+
                                // prevseparator points past the '/' right before the wildcard and nextseparator at the one following it (or at the end of the string)
                                // copy everything up except nextseperator
-                               strlcpy(subpattern, pattern, min(sizeof(subpattern), nextseparator - pattern + 1));
+                               strlcpy(subpattern, pattern, min(sizeof(subpattern), (size_t) (nextseparator - pattern + 1)));
                                // find the last '/' before the wildcard
-                               prevseparator = strrchr( subpattern, '/' ) + 1;
+                               prevseparator = strrchr( subpattern, '/' );
                                if (!prevseparator)
-                               {
                                        prevseparator = subpattern;
-                               }
+                               else
+                                       prevseparator++;
                                // copy everything from start to the previous including the '/' (before the wildcard)
                                // everything up to start is already included in the path of matchedSet's entries
                                strlcpy(subpath, start, min(sizeof(subpath), (size_t) ((prevseparator - subpattern) - (start - pattern) + 1)));
-                               
+
                                // for each entry in matchedSet try to open the subdirectories specified in subpath
                                for( dirlistindex = 0 ; dirlistindex < matchedSet.numstrings ; dirlistindex++ ) {
                                        strlcpy( temp, matchedSet.strings[ dirlistindex ], sizeof(temp) );
                                        strlcat( temp, subpath, sizeof(temp) );
-                                       listdirectory( &foundSet, searchpath->filename, temp );                         
+                                       listdirectory( &foundSet, searchpath->filename, temp );
                                }
                                if( dirlistindex == 0 ) {
                                        break;
@@ -2665,7 +2653,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet)
 
                                start = nextseparator;
                        }
-                       
+
                        for (dirlistindex = 0;dirlistindex < matchedSet.numstrings;dirlistindex++)
                        {
                                const char *temp = matchedSet.strings[dirlistindex];