diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-11 19:40:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-11 19:40:46 +0300 |
commit | 82260a54abbe8a6368d3a5f5da5291e0c4f2eb08 (patch) | |
tree | c61e7cb5151660cecba810b7b3dc3ef0269dd9f5 /src/utils/virtfs.cpp | |
parent | 245fb04a1e112cc8d0918a8660474299d5ce223c (diff) | |
download | ManaVerse-82260a54abbe8a6368d3a5f5da5291e0c4f2eb08.tar.gz ManaVerse-82260a54abbe8a6368d3a5f5da5291e0c4f2eb08.tar.bz2 ManaVerse-82260a54abbe8a6368d3a5f5da5291e0c4f2eb08.tar.xz ManaVerse-82260a54abbe8a6368d3a5f5da5291e0c4f2eb08.zip |
Add checks into virtfs.cpp for correct calls add/remove dirs or archives.
Diffstat (limited to 'src/utils/virtfs.cpp')
-rw-r--r-- | src/utils/virtfs.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp index ef70d119e..7f4c7ab3b 100644 --- a/src/utils/virtfs.cpp +++ b/src/utils/virtfs.cpp @@ -22,6 +22,7 @@ #include "logger.h" +#include "utils/checkutils.h" #include "utils/virtfile.h" #include "utils/virtfileprivate.h" @@ -139,24 +140,44 @@ namespace VirtFs bool addDirToSearchPath(const std::string &newDir, const Append append) { + if (newDir.find(".zip") != std::string::npos) + { + reportAlways("Called addDirToSearchPath with zip archive"); + return false; + } return PHYSFS_addToSearchPath(newDir.c_str(), append == Append_true ? 1 : 0); } bool removeDirFromSearchPath(const std::string &oldDir) { + if (oldDir.find(".zip") != std::string::npos) + { + reportAlways("Called removeDirFromSearchPath with zip archive"); + return false; + } return PHYSFS_removeFromSearchPath(oldDir.c_str()); } bool addZipToSearchPath(const std::string &newDir, const Append append) { + if (newDir.find(".zip") == std::string::npos) + { + reportAlways("Called addZipToSearchPath without zip archive"); + return false; + } return PHYSFS_addToSearchPath(newDir.c_str(), append == Append_true ? 1 : 0); } bool removeZipFromSearchPath(const std::string &oldDir) { + if (oldDir.find(".zip") == std::string::npos) + { + reportAlways("Called removeZipFromSearchPath without zip archive"); + return false; + } return PHYSFS_removeFromSearchPath(oldDir.c_str()); } |