diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-04 00:27:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-04 01:12:19 +0300 |
commit | 79bb654b80d5eb7a65814f80b9ca7ca1ccd62a00 (patch) | |
tree | f9669ee10e2ea3f2c41abaa84830da9efe7f9411 /src/fs/physfs | |
parent | a6c70dd1f32c38cc81cfd4b28f929d7c13d86db1 (diff) | |
download | manaverse-79bb654b80d5eb7a65814f80b9ca7ca1ccd62a00.tar.gz manaverse-79bb654b80d5eb7a65814f80b9ca7ca1ccd62a00.tar.bz2 manaverse-79bb654b80d5eb7a65814f80b9ca7ca1ccd62a00.tar.xz manaverse-79bb654b80d5eb7a65814f80b9ca7ca1ccd62a00.zip |
Reimplement VirtFs in correct way. Now all tests should pass.
Diffstat (limited to 'src/fs/physfs')
-rw-r--r-- | src/fs/physfs/virtfs.cpp | 18 | ||||
-rw-r--r-- | src/fs/physfs/virtfsphys_unittest.cc | 34 |
2 files changed, 9 insertions, 43 deletions
diff --git a/src/fs/physfs/virtfs.cpp b/src/fs/physfs/virtfs.cpp index 9608dfd28..e678e0224 100644 --- a/src/fs/physfs/virtfs.cpp +++ b/src/fs/physfs/virtfs.cpp @@ -59,7 +59,7 @@ namespace VirtFs return VirtFsPhys::getUserDir(); } - bool exists(const std::string &restrict name) + bool exists(std::string name) { return VirtFsPhys::exists(name); } @@ -89,12 +89,12 @@ namespace VirtFs return VirtFsPhys::openRead(filename); } - VirtFile *openWrite(const std::string &restrict filename) + VirtFile *openWrite(std::string filename) { return VirtFsPhys::openWrite(filename); } - VirtFile *openAppend(const std::string &restrict filename) + VirtFile *openAppend(std::string filename) { return VirtFsPhys::openAppend(filename); } @@ -104,35 +104,35 @@ namespace VirtFs return VirtFsPhys::setWriteDir(newDir); } - bool addDirToSearchPath(const std::string &restrict newDir, + bool addDirToSearchPath(std::string newDir, const Append append) { return VirtFsPhys::addDirToSearchPath(newDir, append); } - bool addDirToSearchPathSilent(const std::string &restrict newDir, + bool addDirToSearchPathSilent(std::string newDir, const Append append) { return VirtFsPhys::addDirToSearchPath(newDir, append); } - bool removeDirFromSearchPath(const std::string &restrict oldDir) + bool removeDirFromSearchPath(std::string oldDir) { return VirtFsPhys::removeDirFromSearchPath(oldDir); } - bool removeDirFromSearchPathSilent(const std::string &restrict oldDir) + bool removeDirFromSearchPathSilent(std::string oldDir) { return VirtFsPhys::removeDirFromSearchPath(oldDir); } - bool addZipToSearchPath(const std::string &restrict newDir, + bool addZipToSearchPath(std::string newDir, const Append append) { return VirtFsPhys::addZipToSearchPath(newDir, append); } - bool removeZipFromSearchPath(const std::string &restrict oldDir) + bool removeZipFromSearchPath(std::string oldDir) { return VirtFsPhys::removeZipFromSearchPath(oldDir); } diff --git a/src/fs/physfs/virtfsphys_unittest.cc b/src/fs/physfs/virtfsphys_unittest.cc index f35dedc7f..df3898221 100644 --- a/src/fs/physfs/virtfsphys_unittest.cc +++ b/src/fs/physfs/virtfsphys_unittest.cc @@ -468,40 +468,6 @@ TEST_CASE("VirtFsPhys getRealDir") delete2(logger); } -TEST_CASE("VirtFsPhys permitLinks") -{ - VirtFsPhys::initFuncs(); - logger = new Logger(); - VirtFsPhys::addDirToSearchPath("data", Append_false); - VirtFsPhys::addDirToSearchPath("../data", Append_false); - - const int cnt1 = VirtFsPhys::exists("test/test2.txt") ? 26 : 25; - const int cnt2 = 26; - - StringVect list; - VirtFsPhys::permitLinks(false); - VirtFsPhys::getFiles("test", list); - removeTemp(list); - const size_t sz = list.size(); - REQUIRE(sz == cnt1); - - list.clear(); - VirtFsPhys::permitLinks(true); - VirtFsPhys::getFiles("test", list); - removeTemp(list); - REQUIRE(list.size() == cnt2); - - list.clear(); - VirtFsPhys::permitLinks(false); - VirtFsPhys::getFiles("test", list); - removeTemp(list); - REQUIRE(list.size() == cnt1); - - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); - delete2(logger); -} - TEST_CASE("VirtFsPhys read") { VirtFsPhys::initFuncs(); |