From db76735c07465822b8a6d9f36cb366cd0eba9361 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 4 Aug 2021 21:02:32 -0700 Subject: [PATCH] Fix zip structure checks checking for wrong filename It was checking for .vvv-mnt-temp-XXXXXX/LEVELNAME.vvvvvv instead of LEVELNAME.vvvvvv. When PhysFS enumerates the folder, it only gives us LEVELNAME.vvvvvv, and not .vvv-mnt-temp-XXXXXX/LEVELNAME.vvvvvv. --- desktop_version/src/FileSystemUtils.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 06a4293f..5c0dc034 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -359,6 +359,7 @@ static bool checkZipStructure(const char* filename) { const char* real_dir = PHYSFS_getRealDir(filename); char base_name[MAX_PATH]; + char base_name_suffixed[MAX_PATH]; char real_path[MAX_PATH]; char mount_path[MAX_PATH]; char check_path[MAX_PATH]; @@ -392,18 +393,25 @@ static bool checkZipStructure(const char* filename) VVV_between(filename, "levels/", base_name, ".zip"); + SDL_snprintf( + base_name_suffixed, + sizeof(base_name_suffixed), + "%s.vvvvvv", + base_name + ); + SDL_snprintf( check_path, sizeof(check_path), - "%s%s.vvvvvv", + "%s%s", mount_path, - base_name + base_name_suffixed ); success = PHYSFS_exists(check_path); SDL_zero(zip_state); - zip_state.filename = check_path; + zip_state.filename = base_name_suffixed; PHYSFS_enumerate(mount_path, zipCheckCallback, (void*) &zip_state);