diff --git a/desktop_version/src/CustomLevels.cpp b/desktop_version/src/CustomLevels.cpp index 2a7494cf..704bed37 100644 --- a/desktop_version/src/CustomLevels.cpp +++ b/desktop_version/src/CustomLevels.cpp @@ -251,6 +251,23 @@ static void levelMetaDataCallback(const char* filename) } } +static void unloadZips(void) +{ + char** list = PHYSFS_getSearchPath(); + if (list == NULL) + { + return; + } + for (char** path = list; *path != NULL; path++) + { + if (SDL_strncmp(*path, "levels/", 7) == 0 && endsWith(*path, ".zip")) + { + PHYSFS_unmount(*path); + } + } + PHYSFS_freeList(list); +} + void customlevelclass::getDirectoryData(void) { @@ -258,6 +275,8 @@ void customlevelclass::getDirectoryData(void) FILESYSTEM_clearLevelDirError(); + unloadZips(); + loadZips(); FILESYSTEM_enumerateLevelDirFileNames(levelMetaDataCallback);