From 79bb654b80d5eb7a65814f80b9ca7ca1ccd62a00 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 4 Mar 2017 00:27:54 +0300 Subject: Reimplement VirtFs in correct way. Now all tests should pass. --- src/fs/physfs/virtfs.cpp | 18 +++++++++--------- src/fs/physfs/virtfsphys_unittest.cc | 34 ---------------------------------- 2 files changed, 9 insertions(+), 43 deletions(-) (limited to 'src/fs/physfs') 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(); -- cgit v1.2.3-70-g09d2