X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=fs.c;h=97259f722eb73534781b23c7e3d835cc3733ec06;hp=269490744ab7aacb7fdc3e6a250701f2546de8bb;hb=0706fdfa8e33548670e59234409eac2c51849631;hpb=f13419f00e3f8335e9a25498560a433597f28f50 diff --git a/fs.c b/fs.c index 26949074..97259f72 100644 --- a/fs.c +++ b/fs.c @@ -495,7 +495,7 @@ Unload the Zlib DLL static void PK3_CloseLibrary (void) { #ifndef LINK_TO_ZLIB - Sys_UnloadLibrary (&zlib_dll); + Sys_FreeLibrary (&zlib_dll); #endif } @@ -535,7 +535,7 @@ static qbool PK3_OpenLibrary (void) return true; // Load the DLL - return Sys_LoadLibrary (dllnames, &zlib_dll, zlibfuncs); + return Sys_LoadDependency (dllnames, &zlib_dll, zlibfuncs); #endif } @@ -1329,6 +1329,10 @@ const char *FS_FileExtension (const char *in) { const char *separator, *backslash, *colon, *dot; + dot = strrchr(in, '.'); + if (dot == NULL) + return ""; + separator = strrchr(in, '/'); backslash = strrchr(in, '\\'); if (!separator || separator < backslash) @@ -1337,8 +1341,7 @@ const char *FS_FileExtension (const char *in) if (!separator || separator < colon) separator = colon; - dot = strrchr(in, '.'); - if (dot == NULL || (separator && (dot < separator))) + if (separator && (dot < separator)) return ""; return dot + 1; @@ -1563,7 +1566,7 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl } } - Host_SaveConfig(); + Host_SaveConfig(CONFIGFILENAME); fs_numgamedirs = numgamedirs; for (i = 0;i < fs_numgamedirs;i++) @@ -1574,15 +1577,15 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl if (cls.demoplayback) { - CL_Disconnect_f(&cmd_client); + CL_Disconnect(false, NULL); cls.demonum = 0; } // unload all sounds so they will be reloaded from the new files as needed - S_UnloadAllSounds_f(&cmd_client); + S_UnloadAllSounds_f(cmd_local); // restart the video subsystem after the config is executed - Cbuf_InsertText(&cmd_client, "\nloadconfig\nvid_restart\n\n"); + Cbuf_InsertText(cmd_local, "\nloadconfig\nvid_restart\n\n"); return true; } @@ -1625,7 +1628,7 @@ static void FS_GameDir_f(cmd_state_t *cmd) } // halt demo playback to close the file - CL_Disconnect(); + CL_Disconnect(false, NULL); FS_ChangeGameDirs(numgamedirs, gamedirs, true, true); } @@ -1823,7 +1826,7 @@ static int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t use break; case USERDIRMODE_MYGAMES: if (!shfolder_dll) - Sys_LoadLibrary(shfolderdllnames, &shfolder_dll, shfolderfuncs); + Sys_LoadDependency(shfolderdllnames, &shfolder_dll, shfolderfuncs); mydocsdir[0] = 0; if (qSHGetFolderPath && qSHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, mydocsdir) == S_OK) { @@ -1849,9 +1852,9 @@ static int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t use return -1; case USERDIRMODE_SAVEDGAMES: if (!shell32_dll) - Sys_LoadLibrary(shell32dllnames, &shell32_dll, shell32funcs); + Sys_LoadDependency(shell32dllnames, &shell32_dll, shell32funcs); if (!ole32_dll) - Sys_LoadLibrary(ole32dllnames, &ole32_dll, ole32funcs); + Sys_LoadDependency(ole32dllnames, &ole32_dll, ole32funcs); if (qSHGetKnownFolderPath && qCoInitializeEx && qCoTaskMemFree && qCoUninitialize) { savedgamesdir[0] = 0; @@ -2218,9 +2221,9 @@ void FS_Shutdown (void) PK3_CloseLibrary (); #ifdef WIN32 - Sys_UnloadLibrary (&shfolder_dll); - Sys_UnloadLibrary (&shell32_dll); - Sys_UnloadLibrary (&ole32_dll); + Sys_FreeLibrary (&shfolder_dll); + Sys_FreeLibrary (&shell32_dll); + Sys_FreeLibrary (&ole32_dll); #endif if (fs_mutex) @@ -2507,6 +2510,20 @@ int FS_CheckNastyPath (const char *path, qbool isgamedir) return false; } +/* +==================== +FS_SanitizePath + +Sanitize path (replace non-portable characters +with portable ones in-place, etc) +==================== +*/ +void FS_SanitizePath(char *path) +{ + for (; *path; path++) + if (*path == '\\') + *path = '/'; +} /* ====================