diff --git a/src/modules/filesystem/physfs/File.cpp b/src/modules/filesystem/physfs/File.cpp index 75492af83..e378f28c4 100644 --- a/src/modules/filesystem/physfs/File.cpp +++ b/src/modules/filesystem/physfs/File.cpp @@ -72,7 +72,11 @@ bool File::open(Mode mode) if (file != nullptr) return false; +#ifdef LOVE_USE_PHYSFS_2_1 + PHYSFS_getLastErrorCode(); +#else PHYSFS_getLastError(); // Clear the error buffer. +#endif PHYSFS_File *handle = nullptr; switch (mode) @@ -92,7 +96,11 @@ bool File::open(Mode mode) if (handle == nullptr) { +#ifdef LOVE_USE_PHYSFS_2_1 + const char *err = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); +#else const char *err = PHYSFS_getLastError(); +#endif if (err == nullptr) err = "unknown error"; throw love::Exception("Could not open file %s (%s)", filename.c_str(), err); diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index 15cb7ea29..b34c7ea7e 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -124,7 +124,14 @@ const char *Filesystem::getName() const void Filesystem::init(const char *arg0) { if (!PHYSFS_init(arg0)) - throw love::Exception("%s", PHYSFS_getLastError()); + { +#ifdef LOVE_USE_PHYSFS_2_1 + const char *err = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); +#else + const char *err = PHYSFS_getLastError(); +#endif + throw love::Exception("%s", err); + } // Enable symlinks by default. Also fixes an issue in PhysFS 2.1-alpha. setSymlinksEnabled(true);