]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
WIN32: changed stricmp and strnicmp to have an underscore prefix
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index 6df061215e99b32a195e1ac2dc84c8c2677d9326..40ec10a61ee94461039914bbca8505b57824fcf4 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1079,12 +1079,18 @@ FS_ClearSearchPath
 */
 void FS_ClearSearchPath (void)
 {
+       // unload all packs and directory information, close all pack files
+       // (if a qfile is still reading a pack it won't be harmed because it used
+       //  dup() to get its own handle already)
        while (fs_searchpaths)
        {
                searchpath_t *search = fs_searchpaths;
                fs_searchpaths = search->next;
                if (search->pack)
                {
+                       // close the file
+                       close(search->pack->handle);
+                       // free any memory associated with it
                        if (search->pack->files)
                                Mem_Free(search->pack->files);
                        Mem_Free(search->pack);
@@ -1398,6 +1404,10 @@ FS_Shutdown
 */
 void FS_Shutdown (void)
 {
+       // close all pack files and such
+       // (hopefully there aren't any other open files, but they'll be cleaned up
+       //  by the OS anyway)
+       FS_ClearSearchPath();
        Mem_FreePool (&fs_mempool);
 }