summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-29 17:21:33 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-29 17:25:00 +0300
commit5fc32baadda3e8694731157de54dcfb378689d43 (patch)
tree93f13ac55b68da40e77a2d38fac71a4f53e2d318 /src
parentc1240ed4cf1bdf839837abdf45e27cafe7a9e0bd (diff)
downloadplus-5fc32baadda3e8694731157de54dcfb378689d43.tar.gz
plus-5fc32baadda3e8694731157de54dcfb378689d43.tar.bz2
plus-5fc32baadda3e8694731157de54dcfb378689d43.tar.xz
plus-5fc32baadda3e8694731157de54dcfb378689d43.zip
Another possible fix for broken libs.
Diffstat (limited to 'src')
-rw-r--r--src/utils/physfsrwops.cpp23
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));