mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-04 18:29:41 +01: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:
parent
a8a09a207f
commit
43692388c0
1 changed files with 1 additions and 24 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue