1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-28 15:38:30 +02:00

Use FILESYSTEM_mount() when mounting zips

There's no reason to handle mounting .zip files differently than
mounting a directory... we already mount .data.zip files using
FILESYSTEM_mount(), so why go through the trouble of opening a .zip
manually (which means on Windows the .zip can't be touched for the
duration of playing the custom level), making up a place to mount it at,
and then mount that made-up name, instead of just using
FILESYSTEM_mount()?

Whoever cobbled this asset mounting thing together really didn't fully
understand what they were doing.
This commit is contained in:
Misa 2021-04-03 14:07:51 -07:00 committed by Ethan Lee
parent a8a09a207f
commit 43692388c0

View File

@ -307,35 +307,12 @@ void FILESYSTEM_mountAssets(const char* path)
}
else if (zip_normal != NULL && endsWith(zip_normal, ".zip"))
{
PHYSFS_File* zip = PHYSFS_openRead(zip_normal);
printf("Custom asset directory is .zip at %s\n", zip_normal);
SDL_snprintf(
zip_data,
sizeof(zip_data),
"%s.data.zip",
zip_normal
);
if (zip == NULL)
if (!FILESYSTEM_mount(zip_normal))
{
printf(
"Error loading .zip: %s\n",
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())
);
return;
}
if (PHYSFS_mountHandle(zip, zip_data, "/", 0) == 0)
{
printf(
"Error mounting .zip: %s\n",
PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())
);
return;
}
SDL_strlcpy(assetDir, zip_data, sizeof(assetDir));
graphics.reloadresources();
}