From fd9805fd842de5386c04fb497ace6b5b6ec504fc Mon Sep 17 00:00:00 2001 From: DepressedTWM Date: Mon, 1 Jun 2026 14:31:52 -0400 Subject: [PATCH] ekfjkg --- src/filesystem.cpp | 22 +++++++++------------- src/filesystem.h | 1 + 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/filesystem.cpp b/src/filesystem.cpp index b4e3f23..2d24c1b 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -51,9 +51,8 @@ struct SDLRWIoContext{ : ops(SDL_IOFromFile(filename, "r")), filename(filename) { - if (!ops){ - crash(Exception::SDLError, "Failed to open file: %s", SDL_GetError()); - } + if (!ops) + throw Exception(Exception::SDLError, "Failed to open file: %s", SDL_GetError()); } ~SDLRWIoContext(){ @@ -118,7 +117,7 @@ static PHYSFS_Io *createSDLRWIo(const char *filename){ try{ ctx = new SDLRWIoContext(filename); }catch (const Exception &e){ - crash(Exception::MEOW, "Failed mounting %s", filename); + Debug() << "Failed mounting" << filename; return 0; } @@ -595,20 +594,17 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){ PHYSFS_enumerate(dir, openReadEnumCB, &data); } - if (data.physfsError){ - crash(Exception::PHYSFSError, "PhysFS: %s", data.physfsError); - } + if (data.physfsError) + throw Exception(Exception::PHYSFSError, "PhysFS: %s", data.physfsError); - if (data.matchCount == 0){ - crash(Exception::NoFileError, "%s", filename); - } + if (data.matchCount == 0) + throw Exception(Exception::NoFileError, "%s", filename); } void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){ PHYSFS_File *handle = PHYSFS_openRead(filename); - if (!handle){ - crash(Exception::NoFileError, "%s", filename); - } + if (!handle) + throw Exception(Exception::NoFileError, "%s", filename); initReadOps(handle, stream); } diff --git a/src/filesystem.h b/src/filesystem.h index 5d626c7..66f461e 100644 --- a/src/filesystem.h +++ b/src/filesystem.h @@ -57,6 +57,7 @@ public: /* Circumvents extension supplementing */ void openReadRaw(SDL_IOStream* &ops, const char *filename); + //bool freeOnClose = false); /* Does not perform extension supplementing */ bool exists(const char *filename);