1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 22:18:30 +02:00

Don't use PHYSFS_getRealDir() to check for .zip

Not sure why the original implementation decided to do things this way
instead of snprintf'ing a path to the .zip itself. Otherwise, if the
level is from data.zip, PHYSFS_getRealDir() will return the path of
data.zip, which then fails to mount for separate reasons.
This commit is contained in:
Misa 2021-08-18 09:57:55 -07:00
parent a1df4c1383
commit 124d77c041

View File

@ -513,13 +513,10 @@ bool FILESYSTEM_mountAssets(const char* path)
{
char filename[MAX_PATH];
char virtual_path[MAX_PATH];
const char* real_path;
VVV_between(path, "levels/", filename, ".vvvvvv");
real_path = PHYSFS_getRealDir(path);
/* Check for a zipped up level pack first */
/* Check for a zipped up pack only containing assets first */
SDL_snprintf(
virtual_path,
sizeof(virtual_path),
@ -537,12 +534,20 @@ bool FILESYSTEM_mountAssets(const char* path)
MAYBE_FAIL(graphics.reloadresources());
}
else if (real_path != NULL && endsWith(real_path, ".zip"))
else
{
/* This is a base zip, probably the official data.zip */
printf("Asset directory is .zip at %s\n", real_path);
SDL_snprintf(
virtual_path,
sizeof(virtual_path),
"levels/%s.zip",
filename
);
if (FILESYSTEM_exists(virtual_path))
{
/* This is a full zipped-up level including assets */
printf("Asset directory is .zip at %s\n", virtual_path);
if (!FILESYSTEM_mountAssetsFrom(real_path))
if (!FILESYSTEM_mountAssetsFrom(virtual_path))
{
return false;
}
@ -575,6 +580,7 @@ bool FILESYSTEM_mountAssets(const char* path)
puts("Asset directory does not exist");
}
}
}
return true;