From 579a3052e61ad6b098831eb0be190fd71fbf8063 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 22 Jun 2013 17:04:51 -0300 Subject: [PATCH] Removed restriction on mounting a filepath to root --HG-- branch : love.filesystem.mount2 --- src/modules/filesystem/physfs/Filesystem.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index 935f93db3..475b7587d 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -184,17 +184,13 @@ bool Filesystem::setupWriteDirectory() bool Filesystem::mount(const char *archive, const char *mountpoint) { - if (!isInited || !archive || !mountpoint) + if (!isInited || !archive) return false; // Not allowed for safety reasons. if (strlen(archive) == 0 || strstr(archive, "..") || strcmp(archive, "/") == 0) return false; - // An empty string or "/" is equivalent to doing PHYSFS_addToSearchPath. - if (strlen(mountpoint) == 0 || strcmp(mountpoint, "/") == 0) - return false; - const char *realDir = PHYSFS_getRealDir(archive); if (!realDir) return false; @@ -223,9 +219,8 @@ bool Filesystem::unmount(const char *archive) realPath += LOVE_PATH_SEPARATOR; realPath += archive; - // Make sure the archive path was previously added with PHYSFS_mount. const char *mountPoint = PHYSFS_getMountPoint(realPath.c_str()); - if (!mountPoint || strcmp(mountPoint, "/") == 0) + if (!mountPoint) return false; return PHYSFS_removeFromSearchPath(realPath.c_str());