diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-29 17:21:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-29 17:25:00 +0300 |
commit | 5fc32baadda3e8694731157de54dcfb378689d43 (patch) | |
tree | 93f13ac55b68da40e77a2d38fac71a4f53e2d318 | |
parent | c1240ed4cf1bdf839837abdf45e27cafe7a9e0bd (diff) | |
download | mv-5fc32baadda3e8694731157de54dcfb378689d43.tar.gz mv-5fc32baadda3e8694731157de54dcfb378689d43.tar.bz2 mv-5fc32baadda3e8694731157de54dcfb378689d43.tar.xz mv-5fc32baadda3e8694731157de54dcfb378689d43.zip |
Another possible fix for broken libs.
-rw-r--r-- | src/utils/physfsrwops.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index 67376d3dc..9ca3080a3 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -175,12 +175,21 @@ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle) return retval; } /* PHYSFSRWOPS_makeRWops */ -SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) +#ifdef __APPLE__ +static bool checkFilePath(char *fname) { if (!fname || !*fname) - return nullptr; + return false; + if (!PHYSFS_exists(fname) || PHYSFS_isDirectory(fname)) + return false; + return true; +} +#endif + +SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) +{ #ifdef __APPLE__ - if (!PHYSFS_exists(fname)) + if (!checkFilePath(fname)) return nullptr; #endif return create_rwops(PHYSFS_openRead(fname)); @@ -188,10 +197,8 @@ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) { - if (!fname || !*fname) - return nullptr; #ifdef __APPLE__ - if (!PHYSFS_exists(fname)) + if (!checkFilePath(fname)) return nullptr; #endif return create_rwops(PHYSFS_openWrite(fname)); @@ -199,10 +206,8 @@ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname) { - if (!fname || !*fname) - return nullptr; #ifdef __APPLE__ - if (!PHYSFS_exists(fname)) + if (!checkFilePath(fname)) return nullptr; #endif return create_rwops(PHYSFS_openAppend(fname)); |