This commit is contained in:
DepressedTWM 2026-06-01 14:31:52 -04:00
parent 12cdf73b0d
commit fd9805fd84
2 changed files with 10 additions and 13 deletions

View File

@ -51,9 +51,8 @@ struct SDLRWIoContext{
: ops(SDL_IOFromFile(filename, "r")), : ops(SDL_IOFromFile(filename, "r")),
filename(filename) filename(filename)
{ {
if (!ops){ if (!ops)
crash(Exception::SDLError, "Failed to open file: %s", SDL_GetError()); throw Exception(Exception::SDLError, "Failed to open file: %s", SDL_GetError());
}
} }
~SDLRWIoContext(){ ~SDLRWIoContext(){
@ -118,7 +117,7 @@ static PHYSFS_Io *createSDLRWIo(const char *filename){
try{ try{
ctx = new SDLRWIoContext(filename); ctx = new SDLRWIoContext(filename);
}catch (const Exception &e){ }catch (const Exception &e){
crash(Exception::MEOW, "Failed mounting %s", filename); Debug() << "Failed mounting" << filename;
return 0; return 0;
} }
@ -595,20 +594,17 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){
PHYSFS_enumerate(dir, openReadEnumCB, &data); PHYSFS_enumerate(dir, openReadEnumCB, &data);
} }
if (data.physfsError){ if (data.physfsError)
crash(Exception::PHYSFSError, "PhysFS: %s", data.physfsError); throw Exception(Exception::PHYSFSError, "PhysFS: %s", data.physfsError);
}
if (data.matchCount == 0){ if (data.matchCount == 0)
crash(Exception::NoFileError, "%s", filename); throw Exception(Exception::NoFileError, "%s", filename);
}
} }
void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){ void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){
PHYSFS_File *handle = PHYSFS_openRead(filename); PHYSFS_File *handle = PHYSFS_openRead(filename);
if (!handle){ if (!handle)
crash(Exception::NoFileError, "%s", filename); throw Exception(Exception::NoFileError, "%s", filename);
}
initReadOps(handle, stream); initReadOps(handle, stream);
} }

View File

@ -57,6 +57,7 @@ public:
/* Circumvents extension supplementing */ /* Circumvents extension supplementing */
void openReadRaw(SDL_IOStream* &ops, const char *filename); void openReadRaw(SDL_IOStream* &ops, const char *filename);
//bool freeOnClose = false);
/* Does not perform extension supplementing */ /* Does not perform extension supplementing */
bool exists(const char *filename); bool exists(const char *filename);