diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-09 03:31:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-09 03:31:42 +0300 |
commit | 612873fa462d74a31bdd3977dac7919376038275 (patch) | |
tree | 86c7ce3cb5a0d334bcba5d463846a88e03a8669e | |
parent | 8470d3c82d84a6bd7767de6763153aa9cdfb991b (diff) | |
download | plus-612873fa462d74a31bdd3977dac7919376038275.tar.gz plus-612873fa462d74a31bdd3977dac7919376038275.tar.bz2 plus-612873fa462d74a31bdd3977dac7919376038275.tar.xz plus-612873fa462d74a31bdd3977dac7919376038275.zip |
Simplify add/remove dirs and zips methods in virtfs.
31 files changed, 530 insertions, 530 deletions
diff --git a/src/client.cpp b/src/client.cpp index 961287868..7a7f420ac 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -418,12 +418,12 @@ void Client::gameInit() // Add the main data directories to our PhysicsFS search path if (!settings.options.dataPath.empty()) { - VirtFs::addDirToSearchPath(settings.options.dataPath, + VirtFs::mountDir(settings.options.dataPath, Append_false); } // Add the local data directory to PhysicsFS search path - VirtFs::addDirToSearchPath(settings.localDataDir, + VirtFs::mountDir(settings.localDataDir, Append_false); TranslationManager::loadCurrentLang(); #ifdef ENABLE_CUSTOMNLS @@ -1096,7 +1096,7 @@ int Client::gameExec() "/local/", "zip"); - VirtFs::removeDirFromSearchPathSilent( + VirtFs::unmountDirSilent( settings.localDataDir + dirSeparator + settings.updatesDir + @@ -1319,7 +1319,7 @@ int Client::gameExec() "zip", Append_false); - VirtFs::addDirToSearchPath( + VirtFs::mountDir( settings.localDataDir + dirSeparator + settings.updatesDir + diff --git a/src/dirs.cpp b/src/dirs.cpp index 052ba1dbb..a55953a0b 100644 --- a/src/dirs.cpp +++ b/src/dirs.cpp @@ -189,9 +189,9 @@ void Dirs::extractDataDir() void Dirs::mountDataDir() { - VirtFs::addDirToSearchPathSilent(PKG_DATADIR "data/perserver/default", + VirtFs::mountDirSilent(PKG_DATADIR "data/perserver/default", Append_false); - VirtFs::addDirToSearchPathSilent("data/perserver/default", + VirtFs::mountDirSilent("data/perserver/default", Append_false); #if defined __APPLE__ @@ -208,29 +208,29 @@ void Dirs::mountDataDir() CFRelease(resourcesURL); // possible crash strncat(path, "/data", PATH_MAX - 1); - VirtFs::addDirToSearchPath(path, Append_false); + VirtFs::mountDir(path, Append_false); // possible this need for support run client from dmg images. // mPackageDir = path; #endif // defined __APPLE__ - VirtFs::addDirToSearchPathSilent(PKG_DATADIR "data", Append_false); + VirtFs::mountDirSilent(PKG_DATADIR "data", Append_false); setPackageDir(PKG_DATADIR "data"); - VirtFs::addDirToSearchPathSilent("data", Append_false); + VirtFs::mountDirSilent("data", Append_false); #ifdef ANDROID #ifdef USE_SDL2 if (getenv("APPDIR")) { const std::string appDir = getenv("APPDIR"); - VirtFs::addDirToSearchPath(appDir + "/data", Append_false); - VirtFs::addDirToSearchPath(appDir + "/data/perserver/default", + VirtFs::mountDir(appDir + "/data", Append_false); + VirtFs::mountDir(appDir + "/data/perserver/default", Append_false); } #endif // USE_SDL2 #endif // ANDROID #if defined __native_client__ - VirtFs::addZipToSearchPath("/http/data.zip", Append_false); + VirtFs::mountZip("/http/data.zip", Append_false); #endif // defined __native_client__ // Add branding/data to PhysFS search path @@ -250,7 +250,7 @@ void Dirs::mountDataDir() if (loc > 0) { - VirtFs::addDirToSearchPath(path.substr( + VirtFs::mountDir(path.substr( 0, loc + 1).append("data"), Append_false); } diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp index 78678c3c7..d03616888 100644 --- a/src/dyetool/client.cpp +++ b/src/dyetool/client.cpp @@ -269,12 +269,12 @@ void Client::gameInit() // Add the main data directories to our PhysicsFS search path if (!settings.options.dataPath.empty()) { - VirtFs::addDirToSearchPath(settings.options.dataPath, + VirtFs::mountDir(settings.options.dataPath, Append_false); } // Add the local data directory to PhysicsFS search path - VirtFs::addDirToSearchPath(settings.localDataDir, + VirtFs::mountDir(settings.localDataDir, Append_false); TranslationManager::loadCurrentLang(); #ifdef ENABLE_CUSTOMNLS @@ -645,7 +645,7 @@ int Client::gameExec() "zip", Append_false); - VirtFs::addDirToSearchPath( + VirtFs::mountDir( settings.localDataDir + dirSeparator + settings.updatesDir + "/local/", Append_false); diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp index e36bf8547..a9af12510 100644 --- a/src/dyetool/dyemain.cpp +++ b/src/dyetool/dyemain.cpp @@ -89,8 +89,8 @@ int main(int argc, char **argv) ResourceManager::init(); VirtFs::setWriteDir("."); - VirtFs::addDirToSearchPath(".", Append_false); - VirtFs::addDirToSearchPath("/", Append_false); + VirtFs::mountDir(".", Append_false); + VirtFs::mountDir("/", Append_false); std::string src = argv[1]; std::string dst; if (argc == 4) diff --git a/src/fs/files.cpp b/src/fs/files.cpp index f6a138475..ab40a7d8f 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -47,7 +47,7 @@ void Files::extractLocale() const std::string fileName2 = std::string(getenv( "APPDIR")).append("/locale.zip"); - VirtFs::addZipToSearchPath(fileName2, Append_false); + VirtFs::mountZip(fileName2, Append_false); const std::string localDir = std::string(getenv("APPDIR")).append("/"); VirtList *const rootDirs = VirtFs::enumerateFiles("locale"); @@ -67,7 +67,7 @@ void Files::extractLocale() } } VirtFs::freeList(rootDirs); - VirtFs::removeZipFromSearchPath(fileName2); + VirtFs::unmountZip(fileName2); remove(fileName2.c_str()); } #endif // ANDROID @@ -127,9 +127,9 @@ void Files::extractZip(const std::string &restrict zipName, const std::string &restrict inDir, const std::string &restrict outDir) { - VirtFs::addZipToSearchPath(zipName, Append_false); + VirtFs::mountZip(zipName, Append_false); copyPhysFsDir(inDir, outDir); - VirtFs::removeZipFromSearchPath(zipName); + VirtFs::unmountZip(zipName); remove(zipName.c_str()); } diff --git a/src/fs/files_unittest.cc b/src/fs/files_unittest.cc index d2bac3256..473e0cbdc 100644 --- a/src/fs/files_unittest.cc +++ b/src/fs/files_unittest.cc @@ -36,8 +36,8 @@ TEST_CASE("Files renameFile") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); const int sz = 1234567; char *buf = new char[sz]; @@ -65,8 +65,8 @@ TEST_CASE("Files renameFile") delete [] buf; delete [] buf2; ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -75,14 +75,14 @@ TEST_CASE("Files existsLocal") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); REQUIRE(Files::existsLocal(VirtFs::getPath("help/about.txt")) == true); REQUIRE_FALSE(Files::existsLocal(VirtFs::getPath("help/about1.txt"))); REQUIRE_FALSE(Files::existsLocal(VirtFs::getPath("help1/about.txt"))); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -91,13 +91,13 @@ TEST_CASE("Files loadTextFileString") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); REQUIRE(VirtFs::loadTextFileString("test/simplefile.txt") == "this is test \nfile."); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -106,8 +106,8 @@ TEST_CASE("Files loadTextFile") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); StringVect lines; VirtFs::loadTextFile("test/simplefile.txt", lines); @@ -115,8 +115,8 @@ TEST_CASE("Files loadTextFile") REQUIRE(lines[0] == "this is test "); REQUIRE(lines[1] == "file."); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -125,8 +125,8 @@ TEST_CASE("Files saveTextFile") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); const std::string dir = VirtFs::getPath("test"); REQUIRE(dir.size() > 0); @@ -141,8 +141,8 @@ TEST_CASE("Files saveTextFile") #endif // WIN32 ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -151,8 +151,8 @@ TEST_CASE("Files getFilesInDir") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); StringVect list; VirtFs::getFilesInDir("test", @@ -172,8 +172,8 @@ TEST_CASE("Files getFilesInDir") REQUIRE(list[3] == "perserver/default/features.xml"); REQUIRE(list[4] == "perserver/default/weapons.xml"); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/fs/physfs/virtfs.cpp b/src/fs/physfs/virtfs.cpp index e678e0224..c9fd34ba4 100644 --- a/src/fs/physfs/virtfs.cpp +++ b/src/fs/physfs/virtfs.cpp @@ -104,37 +104,37 @@ namespace VirtFs return VirtFsPhys::setWriteDir(newDir); } - bool addDirToSearchPath(std::string newDir, - const Append append) + bool mountDir(std::string newDir, + const Append append) { - return VirtFsPhys::addDirToSearchPath(newDir, append); + return VirtFsPhys::mountDir(newDir, append); } - bool addDirToSearchPathSilent(std::string newDir, - const Append append) + bool mountDirSilent(std::string newDir, + const Append append) { - return VirtFsPhys::addDirToSearchPath(newDir, append); + return VirtFsPhys::mountDir(newDir, append); } - bool removeDirFromSearchPath(std::string oldDir) + bool unmountDir(std::string oldDir) { - return VirtFsPhys::removeDirFromSearchPath(oldDir); + return VirtFsPhys::unmountDir(oldDir); } - bool removeDirFromSearchPathSilent(std::string oldDir) + bool unmountDirSilent(std::string oldDir) { - return VirtFsPhys::removeDirFromSearchPath(oldDir); + return VirtFsPhys::unmountDir(oldDir); } - bool addZipToSearchPath(std::string newDir, - const Append append) + bool mountZip(std::string newDir, + const Append append) { - return VirtFsPhys::addZipToSearchPath(newDir, append); + return VirtFsPhys::mountZip(newDir, append); } - bool removeZipFromSearchPath(std::string oldDir) + bool unmountZip(std::string oldDir) { - return VirtFsPhys::removeZipFromSearchPath(oldDir); + return VirtFsPhys::unmountZip(oldDir); } std::string getRealDir(std::string filename) diff --git a/src/fs/physfs/virtfsphys.cpp b/src/fs/physfs/virtfsphys.cpp index 439ed2890..f6d0abf47 100644 --- a/src/fs/physfs/virtfsphys.cpp +++ b/src/fs/physfs/virtfsphys.cpp @@ -180,73 +180,73 @@ namespace VirtFsPhys return PHYSFS_setWriteDir(newDir.c_str()); } - bool addDirToSearchPath(const std::string &restrict newDir, - const Append append) + bool mountDir(const std::string &restrict newDir, + const Append append) { logger->log("Add virtual directory: " + newDir); if (newDir.find(".zip") != std::string::npos) { - reportAlways("Called addDirToSearchPath with zip archive"); + reportAlways("Called mountDir with zip archive"); return false; } const int ret = PHYSFS_addToSearchPath(newDir.c_str(), append == Append_true ? 1 : 0); if (ret == 0) { - logger->log("addDirToSearchPath error: %s", + logger->log("mountDir error: %s", VirtFsPhys::getLastError()); } return ret; } - bool removeDirFromSearchPath(const std::string &restrict oldDir) + bool unmountDir(const std::string &restrict oldDir) { logger->log("Remove virtual directory: " + oldDir); if (oldDir.find(".zip") != std::string::npos) { - reportAlways("Called removeDirFromSearchPath with zip archive"); + reportAlways("Called unmountDir with zip archive"); return false; } const int ret = PHYSFS_removeFromSearchPath(oldDir.c_str()); if (ret == 0) { - logger->log("removeDirFromSearchPath error: %s", + logger->log("unmountDir error: %s", VirtFsPhys::getLastError()); } return ret; } - bool addZipToSearchPath(const std::string &restrict newDir, - const Append append) + bool mountZip(const std::string &restrict newDir, + const Append append) { logger->log("Add virtual zip: " + newDir); if (newDir.find(".zip") == std::string::npos) { - reportAlways("Called addZipToSearchPath without zip archive"); + reportAlways("Called mountZip without zip archive"); return false; } const int ret = PHYSFS_addToSearchPath(newDir.c_str(), append == Append_true ? 1 : 0); if (ret == 0) { - logger->log("addZipToSearchPath error: %s", + logger->log("mountZip error: %s", VirtFsPhys::getLastError()); } return ret; } - bool removeZipFromSearchPath(const std::string &restrict oldDir) + bool unmountZip(const std::string &restrict oldDir) { logger->log("Remove virtual zip: " + oldDir); if (oldDir.find(".zip") == std::string::npos) { - reportAlways("Called removeZipFromSearchPath without zip archive"); + reportAlways("Called unmountZip without zip archive"); return false; } const int ret = PHYSFS_removeFromSearchPath(oldDir.c_str()); if (ret == 0) { - logger->log("removeZipFromSearchPath error: %s", + logger->log("unmountZip error: %s", VirtFsPhys::getLastError()); } return ret; diff --git a/src/fs/physfs/virtfsphys.h b/src/fs/physfs/virtfsphys.h index 42394b56b..97b70aae6 100644 --- a/src/fs/physfs/virtfsphys.h +++ b/src/fs/physfs/virtfsphys.h @@ -50,12 +50,12 @@ namespace VirtFsPhys VirtFile *openWrite(const std::string &restrict filename); VirtFile *openAppend(const std::string &restrict filename); bool setWriteDir(const std::string &restrict newDir); - bool addDirToSearchPath(const std::string &restrict newDir, - const Append append); - bool removeDirFromSearchPath(const std::string &restrict oldDir); - bool addZipToSearchPath(const std::string &restrict newDir, - const Append append); - bool removeZipFromSearchPath(const std::string &restrict oldDir); + bool mountDir(const std::string &restrict newDir, + const Append append); + bool unmountDir(const std::string &restrict oldDir); + bool mountZip(const std::string &restrict newDir, + const Append append); + bool unmountZip(const std::string &restrict oldDir); std::string getRealDir(const std::string &restrict filename); bool mkdir(const std::string &restrict dirName); bool remove(const std::string &restrict filename); diff --git a/src/fs/physfs/virtfsphys_unittest.cc b/src/fs/physfs/virtfsphys_unittest.cc index 8137cfb45..429579b05 100644 --- a/src/fs/physfs/virtfsphys_unittest.cc +++ b/src/fs/physfs/virtfsphys_unittest.cc @@ -61,32 +61,32 @@ TEST_CASE("VirtFsPhys exists") { VirtFsPhys::initFuncs(); logger = new Logger(); - VirtFsPhys::addDirToSearchPath("data", Append_false); - VirtFsPhys::addDirToSearchPath("../data", Append_false); + VirtFsPhys::mountDir("data", Append_false); + VirtFsPhys::mountDir("../data", Append_false); REQUIRE(VirtFsPhys::exists("test/units.xml") == true); REQUIRE(VirtFsPhys::exists("test/units123.xml") == false); REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false); REQUIRE(VirtFsPhys::exists("units.xml") == false); - VirtFsPhys::addDirToSearchPath("data/test", Append_false); - VirtFsPhys::addDirToSearchPath("../data/test", Append_false); + VirtFsPhys::mountDir("data/test", Append_false); + VirtFsPhys::mountDir("../data/test", Append_false); REQUIRE(VirtFsPhys::exists("test/units.xml") == true); REQUIRE(VirtFsPhys::exists("test/units123.xml") == false); REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false); REQUIRE(VirtFsPhys::exists("units.xml") == true); - VirtFsPhys::removeDirFromSearchPath("data/test"); - VirtFsPhys::removeDirFromSearchPath("../data/test"); + VirtFsPhys::unmountDir("data/test"); + VirtFsPhys::unmountDir("../data/test"); REQUIRE(VirtFsPhys::exists("test/units.xml") == true); REQUIRE(VirtFsPhys::exists("test/units123.xml") == false); REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false); REQUIRE(VirtFsPhys::exists("units.xml") == false); - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); + VirtFsPhys::unmountDir("data"); + VirtFsPhys::unmountDir("../data"); delete2(logger); } @@ -94,8 +94,8 @@ TEST_CASE("VirtFsPhys exists2") { VirtFsPhys::initFuncs(); logger = new Logger(); - VirtFsPhys::addZipToSearchPath("data/test/test2.zip", Append_false); - VirtFsPhys::addZipToSearchPath("../data/test/test2.zip", Append_false); + VirtFsPhys::mountZip("data/test/test2.zip", Append_false); + VirtFsPhys::mountZip("../data/test/test2.zip", Append_false); REQUIRE(VirtFsPhys::exists("test/units.xml") == false); REQUIRE(VirtFsPhys::exists("test.txt") == true); @@ -103,8 +103,8 @@ TEST_CASE("VirtFsPhys exists2") REQUIRE(VirtFsPhys::exists("tesQ/units.xml") == false); REQUIRE(VirtFsPhys::exists("units.xml") == true); - VirtFsPhys::removeZipFromSearchPath("data/test/test2.zip"); - VirtFsPhys::removeZipFromSearchPath("../data/test/test2.zip"); + VirtFsPhys::unmountZip("data/test/test2.zip"); + VirtFsPhys::unmountZip("../data/test/test2.zip"); delete2(logger); } @@ -139,8 +139,8 @@ TEST_CASE("VirtFsPhys enumerateFiles1") VirtFsPhys::initFuncs(); logger = new Logger; - VirtFsPhys::addDirToSearchPath("data", Append_false); - VirtFsPhys::addDirToSearchPath("../data", Append_false); + VirtFsPhys::mountDir("data", Append_false); + VirtFsPhys::mountDir("../data", Append_false); VirtList *list = nullptr; @@ -166,8 +166,8 @@ TEST_CASE("VirtFsPhys enumerateFiles1") REQUIRE(list->names.size() == cnt1); VirtFsPhys::freeList(list); - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); + VirtFsPhys::unmountDir("data"); + VirtFsPhys::unmountDir("../data"); delete2(logger); } @@ -176,9 +176,9 @@ TEST_CASE("VirtFsPhys enumerateFiles2") VirtFsPhys::initFuncs(); logger = new Logger; - VirtFsPhys::addDirToSearchPath("data/test/dir1", + VirtFsPhys::mountDir("data/test/dir1", Append_false); - VirtFsPhys::addDirToSearchPath("../data/test/dir1", + VirtFsPhys::mountDir("../data/test/dir1", Append_false); VirtList *list = nullptr; @@ -188,8 +188,8 @@ TEST_CASE("VirtFsPhys enumerateFiles2") REQUIRE(list->names.size() == 5); VirtFsPhys::freeList(list); - VirtFsPhys::removeDirFromSearchPath("data/test/dir1"); - VirtFsPhys::removeDirFromSearchPath("../data/test/dir1"); + VirtFsPhys::unmountDir("data/test/dir1"); + VirtFsPhys::unmountDir("../data/test/dir1"); delete2(logger); } @@ -209,9 +209,9 @@ TEST_CASE("VirtFsPhys enumerateFiles3") VirtFsPhys::initFuncs(); logger = new Logger; - VirtFsPhys::addZipToSearchPath("data/test/test.zip", + VirtFsPhys::mountZip("data/test/test.zip", Append_false); - VirtFsPhys::addZipToSearchPath("../data/test/test.zip", + VirtFsPhys::mountZip("../data/test/test.zip", Append_false); VirtList *list = nullptr; @@ -221,8 +221,8 @@ TEST_CASE("VirtFsPhys enumerateFiles3") REQUIRE(inList(list, "test.txt") == false); VirtFsPhys::freeList(list); - VirtFsPhys::removeZipFromSearchPath("data/test/test.zip"); - VirtFsPhys::removeZipFromSearchPath("../data/test/test.zip"); + VirtFsPhys::unmountZip("data/test/test.zip"); + VirtFsPhys::unmountZip("../data/test/test.zip"); delete2(logger); } @@ -231,9 +231,9 @@ TEST_CASE("VirtFsPhys enumerateFiles4") VirtFsPhys::initFuncs(); logger = new Logger; - VirtFsPhys::addZipToSearchPath("data/test/test2.zip", + VirtFsPhys::mountZip("data/test/test2.zip", Append_false); - VirtFsPhys::addZipToSearchPath("../data/test/test2.zip", + VirtFsPhys::mountZip("../data/test/test2.zip", Append_false); VirtList *list = nullptr; @@ -243,8 +243,8 @@ TEST_CASE("VirtFsPhys enumerateFiles4") REQUIRE(inList(list, "test.txt") == true); VirtFsPhys::freeList(list); - VirtFsPhys::removeZipFromSearchPath("data/test/test2.zip"); - VirtFsPhys::removeZipFromSearchPath("../data/test/test2.zip"); + VirtFsPhys::unmountZip("data/test/test2.zip"); + VirtFsPhys::unmountZip("../data/test/test2.zip"); delete2(logger); } @@ -252,8 +252,8 @@ TEST_CASE("VirtFsPhys isDirectory") { VirtFsPhys::initFuncs(); logger = new Logger(); - VirtFsPhys::addDirToSearchPath("data", Append_false); - VirtFsPhys::addDirToSearchPath("../data", Append_false); + VirtFsPhys::mountDir("data", Append_false); + VirtFsPhys::mountDir("../data", Append_false); REQUIRE(VirtFsPhys::isDirectory("test/units.xml") == false); REQUIRE(VirtFsPhys::isDirectory("test/units.xml/") == false); @@ -276,8 +276,8 @@ TEST_CASE("VirtFsPhys isDirectory") REQUIRE(VirtFsPhys::isDirectory("testQ/") == false); REQUIRE(VirtFsPhys::isDirectory("testQ//") == false); - VirtFsPhys::addDirToSearchPath("data/test", Append_false); - VirtFsPhys::addDirToSearchPath("../data/test", Append_false); + VirtFsPhys::mountDir("data/test", Append_false); + VirtFsPhys::mountDir("../data/test", Append_false); REQUIRE(VirtFsPhys::isDirectory("test/units.xml") == false); REQUIRE(VirtFsPhys::isDirectory("test/units.xml/") == false); @@ -289,8 +289,8 @@ TEST_CASE("VirtFsPhys isDirectory") REQUIRE(VirtFsPhys::isDirectory("testQ") == false); REQUIRE(VirtFsPhys::isDirectory("test/dir1") == true); - VirtFsPhys::removeDirFromSearchPath("data/test"); - VirtFsPhys::removeDirFromSearchPath("../data/test"); + VirtFsPhys::unmountDir("data/test"); + VirtFsPhys::unmountDir("../data/test"); REQUIRE(VirtFsPhys::isDirectory("test/units.xml") == false); REQUIRE(VirtFsPhys::isDirectory("test/units123.xml") == false); @@ -302,8 +302,8 @@ TEST_CASE("VirtFsPhys isDirectory") REQUIRE(VirtFsPhys::isDirectory("testQ") == false); REQUIRE(VirtFsPhys::isDirectory("test/dir1") == true); - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); + VirtFsPhys::unmountDir("data"); + VirtFsPhys::unmountDir("../data"); delete2(logger); } @@ -311,8 +311,8 @@ TEST_CASE("VirtFsPhys openRead") { VirtFsPhys::initFuncs(); logger = new Logger(); - VirtFsPhys::addDirToSearchPath("data", Append_false); - VirtFsPhys::addDirToSearchPath("../data", Append_false); + VirtFsPhys::mountDir("data", Append_false); + VirtFsPhys::mountDir("../data", Append_false); VirtFile *file = nullptr; @@ -330,8 +330,8 @@ TEST_CASE("VirtFsPhys openRead") file = VirtFsPhys::openRead("testQ"); REQUIRE(file == nullptr); - VirtFsPhys::addDirToSearchPath("data/test", Append_false); - VirtFsPhys::addDirToSearchPath("../data/test", Append_false); + VirtFsPhys::mountDir("data/test", Append_false); + VirtFsPhys::mountDir("../data/test", Append_false); file = VirtFsPhys::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -348,8 +348,8 @@ TEST_CASE("VirtFsPhys openRead") file = VirtFsPhys::openRead("testQ"); REQUIRE(file == nullptr); - VirtFsPhys::removeDirFromSearchPath("data/test"); - VirtFsPhys::removeDirFromSearchPath("../data/test"); + VirtFsPhys::unmountDir("data/test"); + VirtFsPhys::unmountDir("../data/test"); file = VirtFsPhys::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -365,17 +365,17 @@ TEST_CASE("VirtFsPhys openRead") file = VirtFsPhys::openRead("testQ"); REQUIRE(file == nullptr); - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); + VirtFsPhys::unmountDir("data"); + VirtFsPhys::unmountDir("../data"); delete2(logger); } -TEST_CASE("VirtFsPhys addZipToSearchPath") +TEST_CASE("VirtFsPhys mountZip") { // +++ need implement } -TEST_CASE("VirtFsPhys removeZipFromSearchPath") +TEST_CASE("VirtFsPhys unmountZip") { // +++ need implement } @@ -386,8 +386,8 @@ TEST_CASE("VirtFsPhys getRealDir") logger = new Logger(); REQUIRE(VirtFsPhys::getRealDir(".") == ""); REQUIRE(VirtFsPhys::getRealDir("..") == ""); - const bool dir1 = VirtFsPhys::addDirToSearchPath("data", Append_false); - REQUIRE((dir1 || VirtFsPhys::addDirToSearchPath( + const bool dir1 = VirtFsPhys::mountDir("data", Append_false); + REQUIRE((dir1 || VirtFsPhys::mountDir( "../data", Append_false)) == true); if (dir1 == true) { @@ -403,8 +403,8 @@ TEST_CASE("VirtFsPhys getRealDir") } REQUIRE(VirtFsPhys::getRealDir("zzz") == ""); - VirtFsPhys::addDirToSearchPath("data/test", Append_false); - VirtFsPhys::addDirToSearchPath("../data/test", Append_false); + VirtFsPhys::mountDir("data/test", Append_false); + VirtFsPhys::mountDir("../data/test", Append_false); if (dir1 == true) { REQUIRE(VirtFsPhys::getRealDir("test") == "data"); @@ -425,21 +425,21 @@ TEST_CASE("VirtFsPhys getRealDir") if (dir1 == true) { - VirtFsPhys::addZipToSearchPath("data/test/test.zip", Append_false); + VirtFsPhys::mountZip("data/test/test.zip", Append_false); REQUIRE(VirtFsPhys::getRealDir("dir/brimmedhat.png") == "data/test/test.zip"); REQUIRE(VirtFsPhys::getRealDir("hide.png") == "data/test"); } else { - VirtFsPhys::addZipToSearchPath("../data/test/test.zip", Append_false); + VirtFsPhys::mountZip("../data/test/test.zip", Append_false); REQUIRE(VirtFsPhys::getRealDir("dir/brimmedhat.png") == "../data/test/test.zip"); REQUIRE(VirtFsPhys::getRealDir("hide.png") == "../data/test"); } - VirtFsPhys::removeDirFromSearchPath("data/test"); - VirtFsPhys::removeDirFromSearchPath("../data/test"); + VirtFsPhys::unmountDir("data/test"); + VirtFsPhys::unmountDir("../data/test"); if (dir1 == true) { @@ -460,10 +460,10 @@ TEST_CASE("VirtFsPhys getRealDir") REQUIRE(VirtFsPhys::exists("dir/hide.png")); REQUIRE(VirtFsPhys::getRealDir("zzz") == ""); - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); - VirtFsPhys::removeZipFromSearchPath("data/test/test.zip"); - VirtFsPhys::removeZipFromSearchPath("../data/test/test.zip"); + VirtFsPhys::unmountDir("data"); + VirtFsPhys::unmountDir("../data"); + VirtFsPhys::unmountZip("data/test/test.zip"); + VirtFsPhys::unmountZip("../data/test/test.zip"); delete2(logger); } @@ -471,8 +471,8 @@ TEST_CASE("VirtFsPhys read") { VirtFsPhys::initFuncs(); logger = new Logger(); - VirtFsPhys::addDirToSearchPath("data", Append_false); - VirtFsPhys::addDirToSearchPath("../data", Append_false); + VirtFsPhys::mountDir("data", Append_false); + VirtFsPhys::mountDir("../data", Append_false); VirtFile *file = VirtFsPhys::openRead("test/test.txt"); REQUIRE(file != nullptr); @@ -499,8 +499,8 @@ TEST_CASE("VirtFsPhys read") VirtFsPhys::close(file); free(buffer); - VirtFsPhys::removeDirFromSearchPath("data"); - VirtFsPhys::removeDirFromSearchPath("../data"); + VirtFsPhys::unmountDir("data"); + VirtFsPhys::unmountDir("../data"); delete2(logger); } #endif // USE_PHYSFS diff --git a/src/fs/virtfs.h b/src/fs/virtfs.h index f27afac67..0b0a4b5d3 100644 --- a/src/fs/virtfs.h +++ b/src/fs/virtfs.h @@ -46,15 +46,15 @@ namespace VirtFs VirtFile *openWrite(std::string filename); VirtFile *openAppend(std::string filename); bool setWriteDir(const std::string &restrict newDir); - bool addDirToSearchPath(std::string newDir, - const Append append); - bool addDirToSearchPathSilent(std::string newDir, - const Append append); - bool removeDirFromSearchPath(std::string oldDir); - bool removeDirFromSearchPathSilent(std::string oldDir); - bool addZipToSearchPath(std::string newDir, - const Append append); - bool removeZipFromSearchPath(std::string oldDir); + bool mountDir(std::string newDir, + const Append append); + bool mountDirSilent(std::string newDir, + const Append append); + bool unmountDir(std::string oldDir); + bool unmountDirSilent(std::string oldDir); + bool mountZip(std::string newDir, + const Append append); + bool unmountZip(std::string oldDir); std::string getRealDir(std::string filename); bool mkdir(const std::string &restrict dirName); bool remove(const std::string &restrict filename); diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp index ad9c28d53..9cc36fda8 100644 --- a/src/fs/virtfs/virtfs.cpp +++ b/src/fs/virtfs/virtfs.cpp @@ -271,8 +271,8 @@ namespace VirtFs mEntries.insert(mEntries.begin(), entry); } - bool addDirToSearchPathInternal(const std::string &restrict newDir, - const Append append) + bool mountDirInternal(const std::string &restrict newDir, + const Append append) { if (newDir.find(".zip") != std::string::npos) { @@ -295,8 +295,8 @@ namespace VirtFs return true; } - bool addDirToSearchPath(std::string newDir, - const Append append) + bool mountDir(std::string newDir, + const Append append) { prepareFsPath(newDir); if (Files::existsLocal(newDir) == false) @@ -305,11 +305,11 @@ namespace VirtFs newDir.c_str()); return false; } - return addDirToSearchPathInternal(newDir, append); + return mountDirInternal(newDir, append); } - bool addDirToSearchPathSilent(std::string newDir, - const Append append) + bool mountDirSilent(std::string newDir, + const Append append) { prepareFsPath(newDir); if (Files::existsLocal(newDir) == false) @@ -318,12 +318,12 @@ namespace VirtFs newDir.c_str()); return false; } - return addDirToSearchPathInternal(newDir, append); + return mountDirInternal(newDir, append); } #ifdef UNITTESTS - bool addDirToSearchPathSilent2(std::string newDir, - const Append append) + bool mountDirSilent2(std::string newDir, + const Append append) { prepareFsPath(newDir); if (Files::existsLocal(newDir) == false) @@ -331,11 +331,11 @@ namespace VirtFs logger->log("VirtFs::addToSearchPath directory not exists: %s", newDir.c_str()); } - return addDirToSearchPathInternal(newDir, append); + return mountDirInternal(newDir, append); } #endif // UNITTESTS - bool removeDirFromSearchPathInternal(std::string oldDir) + bool unmountDirInternal(std::string oldDir) { if (findLast(oldDir, std::string(dirSeparator)) == false) oldDir += dirSeparator; @@ -356,7 +356,7 @@ namespace VirtFs return false; } - bool removeDirFromSearchPath(std::string oldDir) + bool unmountDir(std::string oldDir) { prepareFsPath(oldDir); if (oldDir.find(".zip") != std::string::npos) @@ -364,16 +364,16 @@ namespace VirtFs reportAlways("Called removeFromSearchPath with zip archive"); return false; } - if (removeDirFromSearchPathInternal(oldDir) == false) + if (unmountDirInternal(oldDir) == false) { - reportAlways("VirtFs::removeDirFromSearchPath not exists: %s", + reportAlways("VirtFs::unmountDir not exists: %s", oldDir.c_str()); return false; } return true; } - bool removeDirFromSearchPathSilent(std::string oldDir) + bool unmountDirSilent(std::string oldDir) { prepareFsPath(oldDir); if (oldDir.find(".zip") != std::string::npos) @@ -381,17 +381,17 @@ namespace VirtFs reportAlways("Called removeFromSearchPath with zip archive"); return false; } - if (removeDirFromSearchPathInternal(oldDir) == false) + if (unmountDirInternal(oldDir) == false) { - logger->log("VirtFs::removeDirFromSearchPath not exists: %s", + logger->log("VirtFs::unmountDir not exists: %s", oldDir.c_str()); return false; } return true; } - bool addZipToSearchPath(std::string newDir, - const Append append) + bool mountZip(std::string newDir, + const Append append) { prepareFsPath(newDir); if (Files::existsLocal(newDir) == false) @@ -425,7 +425,7 @@ namespace VirtFs return true; } - bool removeZipFromSearchPath(std::string oldDir) + bool unmountZip(std::string oldDir) { prepareFsPath(oldDir); if (findLast(oldDir, ".zip") == false) @@ -448,7 +448,7 @@ namespace VirtFs } } - reportAlways("VirtFs::removeZipFromSearchPath not exists: %s", + reportAlways("VirtFs::unmountZip not exists: %s", oldDir.c_str()); return false; } diff --git a/src/fs/virtfs/virtfs.h b/src/fs/virtfs/virtfs.h index 056cb3673..408a54832 100644 --- a/src/fs/virtfs/virtfs.h +++ b/src/fs/virtfs/virtfs.h @@ -34,9 +34,9 @@ struct VirtFsEntry; namespace VirtFs { - bool addDirToSearchPathInternal(const std::string &restrict newDir, - const Append append); - bool removeDirFromSearchPathInternal(std::string oldDir); + bool mountDirInternal(const std::string &restrict newDir, + const Append append); + bool unmountDirInternal(std::string oldDir); std::vector<VirtFsEntry*> &getEntries(); VirtFsEntry *searchEntryByRootInternal(const std::string &restrict root); @@ -45,8 +45,8 @@ namespace VirtFs void addEntry(VirtFsEntry *const entry, const Append append); #ifdef UNITTESTS - bool addDirToSearchPathSilent2(std::string newDir, - const Append append); + bool mountDirSilent2(std::string newDir, + const Append append); #endif // UNITTESTS } // namespace VirtFs diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc index 8047c879c..bf040d707 100644 --- a/src/fs/virtfs/virtfs_unittest.cc +++ b/src/fs/virtfs/virtfs_unittest.cc @@ -51,14 +51,14 @@ TEST_CASE("VirtFs1 getBaseDir") VirtFs::deinit(); } -TEST_CASE("VirtFs1 addDirToSearchPath") +TEST_CASE("VirtFs1 mountDir") { VirtFs::init("."); logger = new Logger(); const std::string sep = dirSeparator; SECTION("simple 1") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal("dir1" + sep) != nullptr); REQUIRE(VirtFs::searchEntryByRootInternal("test" + sep) == nullptr); @@ -71,7 +71,7 @@ TEST_CASE("VirtFs1 addDirToSearchPath") SECTION("simple 2") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1/", + REQUIRE(VirtFs::mountDirSilent2("dir1/", Append_true)); REQUIRE(VirtFs::searchEntryByRootInternal("dir1" + sep) != nullptr); REQUIRE(VirtFs::searchEntryByRootInternal("test" + sep) == nullptr); @@ -84,9 +84,9 @@ TEST_CASE("VirtFs1 addDirToSearchPath") SECTION("simple 3") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_false)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir2", + REQUIRE(VirtFs::mountDirSilent2("dir2", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal("dir1" + sep) != nullptr); REQUIRE(VirtFs::searchEntryByRootInternal("dir2" + sep) != nullptr); @@ -104,9 +104,9 @@ TEST_CASE("VirtFs1 addDirToSearchPath") SECTION("simple 4") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1\\", + REQUIRE(VirtFs::mountDirSilent2("dir1\\", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir2", + REQUIRE(VirtFs::mountDirSilent2("dir2", Append_true)); REQUIRE(VirtFs::searchEntryByRootInternal("dir1" + sep) != nullptr); REQUIRE(VirtFs::searchEntryByRootInternal("dir2" + sep) != nullptr); @@ -124,11 +124,11 @@ TEST_CASE("VirtFs1 addDirToSearchPath") SECTION("simple 5") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir2", + REQUIRE(VirtFs::mountDirSilent2("dir2", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir3/test", + REQUIRE(VirtFs::mountDirSilent2("dir3/test", Append_true)); REQUIRE(VirtFs::searchEntryByRootInternal("dir1" + sep) != nullptr); REQUIRE(VirtFs::searchEntryByRootInternal("dir2" + sep) != nullptr); @@ -152,11 +152,11 @@ TEST_CASE("VirtFs1 addDirToSearchPath") SECTION("simple 6") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir2", + REQUIRE(VirtFs::mountDirSilent2("dir2", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir3\\test", + REQUIRE(VirtFs::mountDirSilent2("dir3\\test", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal( "dir1" + sep + "") != nullptr); @@ -185,7 +185,7 @@ TEST_CASE("VirtFs1 addDirToSearchPath") delete2(logger); } -TEST_CASE("VirtFs1 addZipToSearchPath") +TEST_CASE("VirtFs1 mountZip") { VirtFs::init("."); logger = new Logger(); @@ -198,7 +198,7 @@ TEST_CASE("VirtFs1 addZipToSearchPath") SECTION("simple 1") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") != nullptr); @@ -212,9 +212,9 @@ TEST_CASE("VirtFs1 addZipToSearchPath") SECTION("simple 2") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_false)); - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") != nullptr); @@ -231,9 +231,9 @@ TEST_CASE("VirtFs1 addZipToSearchPath") SECTION("simple 3") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_true)); - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test2.zip", Append_true)); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") != nullptr); @@ -250,11 +250,11 @@ TEST_CASE("VirtFs1 addZipToSearchPath") SECTION("simple 4") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_false)); - REQUIRE(VirtFs::addDirToSearchPath(prefix + "data/test", + REQUIRE(VirtFs::mountDir(prefix + "data/test", Append_false)); - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") != nullptr); @@ -276,11 +276,11 @@ TEST_CASE("VirtFs1 addZipToSearchPath") SECTION("simple 5") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_false)); - REQUIRE(VirtFs::addDirToSearchPath(prefix + "data/test", + REQUIRE(VirtFs::mountDir(prefix + "data/test", Append_false)); - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test2.zip", Append_true)); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") != nullptr); @@ -317,29 +317,29 @@ TEST_CASE("VirtFs1 removeFromSearchPath") SECTION("simple 1") { - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir1")); - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir1/")); + REQUIRE_THROWS(VirtFs::unmountDir("dir1")); + REQUIRE_THROWS(VirtFs::unmountDir("dir1/")); } SECTION("simple 2") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_true)); - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir2")); - REQUIRE(VirtFs::removeDirFromSearchPath("dir1")); + REQUIRE_THROWS(VirtFs::unmountDir("dir2")); + REQUIRE(VirtFs::unmountDir("dir1")); } SECTION("simple 3") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir2//dir3", + REQUIRE(VirtFs::mountDirSilent2("dir2//dir3", Append_true)); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir3", + REQUIRE(VirtFs::mountDirSilent2("dir3", Append_false)); REQUIRE(VirtFs::getEntries().size() == 3); - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir2")); - REQUIRE(VirtFs::removeDirFromSearchPath("dir1")); + REQUIRE_THROWS(VirtFs::unmountDir("dir2")); + REQUIRE(VirtFs::unmountDir("dir1")); REQUIRE(VirtFs::getEntries().size() == 2); REQUIRE(VirtFs::getEntries()[0]->root == "dir3" + sep); REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir); @@ -349,7 +349,7 @@ TEST_CASE("VirtFs1 removeFromSearchPath") REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir); REQUIRE(static_cast<VirtDirEntry*>( VirtFs::getEntries()[1])->userDir == "dir2" + sep + "dir3"); - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir1")); + REQUIRE_THROWS(VirtFs::unmountDir("dir1")); REQUIRE(VirtFs::getEntries().size() == 2); REQUIRE(VirtFs::getEntries()[0]->root == "dir3" + sep); REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir); @@ -359,8 +359,8 @@ TEST_CASE("VirtFs1 removeFromSearchPath") REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir); REQUIRE(static_cast<VirtDirEntry*>( VirtFs::getEntries()[1])->userDir == "dir2" + sep + "dir3"); - REQUIRE(VirtFs::removeDirFromSearchPath("dir2/dir3")); - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir2/dir3" + sep)); + REQUIRE(VirtFs::unmountDir("dir2/dir3")); + REQUIRE_THROWS(VirtFs::unmountDir("dir2/dir3" + sep)); REQUIRE(VirtFs::getEntries().size() == 1); REQUIRE(VirtFs::getEntries()[0]->root == "dir3" + sep); REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir); @@ -370,17 +370,17 @@ TEST_CASE("VirtFs1 removeFromSearchPath") SECTION("simple 4") { - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_true)); REQUIRE(VirtFs::getEntries().size() == 1); REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep); REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir); REQUIRE(static_cast<VirtDirEntry*>( VirtFs::getEntries()[0])->userDir == "dir1"); - REQUIRE_THROWS(VirtFs::removeDirFromSearchPath("dir2")); - REQUIRE(VirtFs::removeDirFromSearchPath("dir1")); + REQUIRE_THROWS(VirtFs::unmountDir("dir2")); + REQUIRE(VirtFs::unmountDir("dir1")); REQUIRE(VirtFs::getEntries().size() == 0); - REQUIRE(VirtFs::addDirToSearchPathSilent2("dir1", + REQUIRE(VirtFs::mountDirSilent2("dir1", Append_true)); REQUIRE(VirtFs::getEntries().size() == 1); REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep); @@ -391,9 +391,9 @@ TEST_CASE("VirtFs1 removeFromSearchPath") SECTION("simple 5") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_true)); - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test2.zip", Append_true)); REQUIRE(VirtFs::searchEntryByRootInternal( @@ -408,7 +408,7 @@ TEST_CASE("VirtFs1 removeFromSearchPath") prefix + "data" + sep + "test" + sep + "test2.zip"); REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Zip); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") == nullptr); REQUIRE(VirtFs::searchEntryByRootInternal( @@ -421,11 +421,11 @@ TEST_CASE("VirtFs1 removeFromSearchPath") SECTION("simple 6") { - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + REQUIRE(VirtFs::mountZip(prefix + "data/test/test.zip", Append_false)); - REQUIRE(VirtFs::addDirToSearchPath(prefix + "data/test", + REQUIRE(VirtFs::mountDir(prefix + "data/test", Append_false)); - REQUIRE(VirtFs::addZipToSearchPath(prefix + "data\\test/test2.zip", + REQUIRE(VirtFs::mountZip(prefix + "data\\test/test2.zip", Append_false)); REQUIRE(VirtFs::searchEntryByRootInternal( @@ -445,7 +445,7 @@ TEST_CASE("VirtFs1 removeFromSearchPath") prefix + "data" + sep + "test" + sep + "test.zip"); REQUIRE(VirtFs::getEntries()[2]->type == FsEntryType::Zip); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(VirtFs::searchEntryByRootInternal( prefix + "data" + sep + "test" + sep + "test.zip") == nullptr); REQUIRE(VirtFs::searchEntryByRootInternal( @@ -469,9 +469,9 @@ TEST_CASE("VirtFs1 exists") { VirtFs::init("."); logger = new Logger(); - const bool dir1 = VirtFs::addDirToSearchPathSilent("data/", + const bool dir1 = VirtFs::mountDirSilent("data/", Append_false); - VirtFs::addDirToSearchPathSilent("..\\data", + VirtFs::mountDirSilent("..\\data", Append_false); REQUIRE(VirtFs::exists("test")); @@ -486,12 +486,12 @@ TEST_CASE("VirtFs1 exists") if (dir1 == true) { - VirtFs::addDirToSearchPath("data//test", + VirtFs::mountDir("data//test", Append_false); } else { - VirtFs::addDirToSearchPathSilent("..//data\\test", + VirtFs::mountDirSilent("..//data\\test", Append_false); } @@ -506,9 +506,9 @@ TEST_CASE("VirtFs1 exists") REQUIRE(VirtFs::exists("units.xml/") == false); if (dir1 == true) - VirtFs::removeDirFromSearchPathSilent("data/test"); + VirtFs::unmountDirSilent("data/test"); else - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("../data/test"); REQUIRE(VirtFs::exists("test") == true); REQUIRE(VirtFs::exists("test/dir1")); @@ -558,9 +558,9 @@ TEST_CASE("VirtFs1 getRealDir1") const std::string sep = dirSeparator; REQUIRE(VirtFs::getRealDir(".") == ""); REQUIRE(VirtFs::getRealDir("..") == ""); - const bool dir1 = VirtFs::addDirToSearchPathSilent("data", + const bool dir1 = VirtFs::mountDirSilent("data", Append_false); - REQUIRE((dir1 || VirtFs::addDirToSearchPathSilent("../data", + REQUIRE((dir1 || VirtFs::mountDirSilent("../data", Append_false)) == true); if (dir1 == true) { @@ -584,9 +584,9 @@ TEST_CASE("VirtFs1 getRealDir1") } REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::addDirToSearchPathSilent("data/test", + VirtFs::mountDirSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", + VirtFs::mountDirSilent("../data/test", Append_false); if (dir1 == true) { @@ -610,8 +610,8 @@ TEST_CASE("VirtFs1 getRealDir1") } REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); if (dir1 == true) { @@ -627,8 +627,8 @@ TEST_CASE("VirtFs1 getRealDir1") } REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); VirtFs::deinit(); delete2(logger); } @@ -642,7 +642,7 @@ TEST_CASE("VirtFs1 getRealDir2") std::string prefix("data" + sep + "test" + sep); if (Files::existsLocal(name) == false) prefix = ".." + sep + prefix; - VirtFs::addZipToSearchPath(prefix + "test2.zip", + VirtFs::mountZip(prefix + "test2.zip", Append_false); REQUIRE(VirtFs::getRealDir(".") == ""); @@ -653,7 +653,7 @@ TEST_CASE("VirtFs1 getRealDir2") prefix + "test2.zip"); REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::addZipToSearchPath(prefix + "test.zip", + VirtFs::mountZip(prefix + "test.zip", Append_false); REQUIRE(VirtFs::getRealDir("dir//dye.png") == prefix + "test2.zip"); @@ -663,7 +663,7 @@ TEST_CASE("VirtFs1 getRealDir2") prefix + "test.zip"); REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::removeZipFromSearchPath(prefix + "test.zip"); + VirtFs::unmountZip(prefix + "test.zip"); REQUIRE(VirtFs::getRealDir("dir/brimmedhat.png") == ""); REQUIRE(VirtFs::getRealDir("test.txt") == prefix + "test2.zip"); @@ -671,7 +671,7 @@ TEST_CASE("VirtFs1 getRealDir2") prefix + "test2.zip"); REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::removeZipFromSearchPath(prefix + "test2.zip"); + VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); delete2(logger); } @@ -692,9 +692,9 @@ TEST_CASE("VirtFs1 enumerateFiles1") VirtFs::init("."); logger = new Logger; - VirtFs::addDirToSearchPathSilent("data", + VirtFs::mountDirSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", + VirtFs::mountDirSilent("../data", Append_false); VirtList *list = nullptr; @@ -726,8 +726,8 @@ TEST_CASE("VirtFs1 enumerateFiles1") REQUIRE(list->names.size() == cnt1); VirtFs::freeList(list); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); VirtFs::deinit(); delete2(logger); } @@ -737,9 +737,9 @@ TEST_CASE("VirtFs1 enumerateFiles2") VirtFs::init("."); logger = new Logger; - VirtFs::addDirToSearchPathSilent("data/test/dir1", + VirtFs::mountDirSilent("data/test/dir1", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test/dir1", + VirtFs::mountDirSilent("../data/test/dir1", Append_false); VirtList *list = nullptr; @@ -759,13 +759,13 @@ TEST_CASE("VirtFs1 enumerateFiles3") VirtFs::init("."); logger = new Logger; - VirtFs::addDirToSearchPathSilent("data/test/dir1", + VirtFs::mountDirSilent("data/test/dir1", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test/dir1", + VirtFs::mountDirSilent("../data/test/dir1", Append_false); - VirtFs::addDirToSearchPathSilent("data/test/dir2", + VirtFs::mountDirSilent("data/test/dir2", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test/dir2", + VirtFs::mountDirSilent("../data/test/dir2", Append_false); VirtList *list = nullptr; @@ -789,7 +789,7 @@ TEST_CASE("VirtFsZip enumerateFiles4") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "test.zip", + VirtFs::mountZip(prefix + "test.zip", Append_false); VirtList *list = nullptr; @@ -800,7 +800,7 @@ TEST_CASE("VirtFsZip enumerateFiles4") REQUIRE(inList(list, "hide.png")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "test.zip"); + VirtFs::unmountZip(prefix + "test.zip"); VirtFs::deinit(); delete2(logger); } @@ -814,9 +814,9 @@ TEST_CASE("VirtFsZip enumerateFiles5") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "test.zip", + VirtFs::mountZip(prefix + "test.zip", Append_true); - VirtFs::addZipToSearchPath(prefix + "test2.zip", + VirtFs::mountZip(prefix + "test2.zip", Append_true); VirtList *list = nullptr; @@ -835,8 +835,8 @@ TEST_CASE("VirtFsZip enumerateFiles5") REQUIRE(inList(list, "dye.png")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "test.zip"); - VirtFs::removeZipFromSearchPath(prefix + "test2.zip"); + VirtFs::unmountZip(prefix + "test.zip"); + VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); delete2(logger); } @@ -850,7 +850,7 @@ TEST_CASE("VirtFsZip enumerateFiles6") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "test.zip", + VirtFs::mountZip(prefix + "test.zip", Append_false); VirtList *list = nullptr; @@ -860,7 +860,7 @@ TEST_CASE("VirtFsZip enumerateFiles6") REQUIRE(inList(list, "dir")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "test.zip"); + VirtFs::unmountZip(prefix + "test.zip"); VirtFs::deinit(); delete2(logger); } @@ -874,7 +874,7 @@ TEST_CASE("VirtFsZip enumerateFiles7") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "test2.zip", + VirtFs::mountZip(prefix + "test2.zip", Append_false); VirtList *list = nullptr; @@ -887,7 +887,7 @@ TEST_CASE("VirtFsZip enumerateFiles7") REQUIRE(inList(list, "units.xml")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "test2.zip"); + VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); delete2(logger); } @@ -901,9 +901,9 @@ TEST_CASE("VirtFsZip enumerateFiles8") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); - VirtFs::addDirToSearchPathSilent(prefix + "data/test", + VirtFs::mountDirSilent(prefix + "data/test", Append_false); VirtList *list = nullptr; @@ -918,8 +918,8 @@ TEST_CASE("VirtFsZip enumerateFiles8") REQUIRE(inList(list, "units.xml")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); + VirtFs::unmountDir(prefix + "data/test"); VirtFs::deinit(); delete2(logger); } @@ -933,7 +933,7 @@ TEST_CASE("VirtFs1 isDirectory1") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPath(prefix + "data", + VirtFs::mountDir(prefix + "data", Append_false); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); @@ -957,7 +957,7 @@ TEST_CASE("VirtFs1 isDirectory1") REQUIRE(VirtFs::isDirectory("testQ/") == false); REQUIRE(VirtFs::isDirectory("testQ//") == false); - VirtFs::addDirToSearchPath(prefix + "data/test", + VirtFs::mountDir(prefix + "data/test", Append_false); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); @@ -971,7 +971,7 @@ TEST_CASE("VirtFs1 isDirectory1") REQUIRE(VirtFs::isDirectory("test/dir1") == true); REQUIRE(VirtFs::isDirectory("test\\dir1") == true); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); + VirtFs::unmountDir(prefix + "data/test"); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); REQUIRE(VirtFs::isDirectory("test/units123.xml") == false); @@ -983,7 +983,7 @@ TEST_CASE("VirtFs1 isDirectory1") REQUIRE(VirtFs::isDirectory("testQ") == false); REQUIRE(VirtFs::isDirectory("test/dir1") == true); - VirtFs::removeDirFromSearchPathSilent(prefix + "data"); + VirtFs::unmountDirSilent(prefix + "data"); VirtFs::deinit(); delete2(logger); } @@ -997,7 +997,7 @@ TEST_CASE("VirtFs1 isDirectory2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); REQUIRE(VirtFs::isDirectory("dir2/units.xml") == false); @@ -1021,7 +1021,7 @@ TEST_CASE("VirtFs1 isDirectory2") REQUIRE(VirtFs::isDirectory("testQ/") == false); REQUIRE(VirtFs::isDirectory("testQ//") == false); - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); REQUIRE(VirtFs::isDirectory("dir2/units.xml") == false); @@ -1045,7 +1045,7 @@ TEST_CASE("VirtFs1 isDirectory2") REQUIRE(VirtFs::isDirectory("testQ/") == false); REQUIRE(VirtFs::isDirectory("testQ//") == false); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); REQUIRE(VirtFs::isDirectory("dir2/units.xml") == false); REQUIRE(VirtFs::isDirectory("dir2/units.xml/") == false); @@ -1068,7 +1068,7 @@ TEST_CASE("VirtFs1 isDirectory2") REQUIRE(VirtFs::isDirectory("testQ/") == false); REQUIRE(VirtFs::isDirectory("testQ//") == false); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); VirtFs::deinit(); delete2(logger); } @@ -1082,7 +1082,7 @@ TEST_CASE("VirtFs1 openRead1") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPath(prefix + "data", + VirtFs::mountDir(prefix + "data", Append_false); VirtFile *file = nullptr; @@ -1102,7 +1102,7 @@ TEST_CASE("VirtFs1 openRead1") file = VirtFs::openRead("testQ"); REQUIRE(file == nullptr); - VirtFs::addDirToSearchPath(prefix + "data/test", + VirtFs::mountDir(prefix + "data/test", Append_false); file = VirtFs::openRead("test/units.xml"); @@ -1118,7 +1118,7 @@ TEST_CASE("VirtFs1 openRead1") file = VirtFs::openRead("testQ"); REQUIRE(file == nullptr); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); + VirtFs::unmountDir(prefix + "data/test"); file = VirtFs::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -1132,7 +1132,7 @@ TEST_CASE("VirtFs1 openRead1") file = VirtFs::openRead("testQ"); REQUIRE(file == nullptr); - VirtFs::removeDirFromSearchPath(prefix + "data"); + VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); delete2(logger); } @@ -1146,7 +1146,7 @@ TEST_CASE("VirtFs1 openRead2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "test2.zip", + VirtFs::mountZip(prefix + "test2.zip", Append_false); VirtFile *file = nullptr; @@ -1170,7 +1170,7 @@ TEST_CASE("VirtFs1 openRead2") file = VirtFs::openRead("dir//brimmedhat.png"); REQUIRE(file == nullptr); - VirtFs::addZipToSearchPath(prefix + "test.zip", + VirtFs::mountZip(prefix + "test.zip", Append_false); file = VirtFs::openRead("dir2/units.xml"); @@ -1191,7 +1191,7 @@ TEST_CASE("VirtFs1 openRead2") REQUIRE(file != nullptr); VirtFs::close(file); - VirtFs::removeZipFromSearchPath(prefix + "test.zip"); + VirtFs::unmountZip(prefix + "test.zip"); file = VirtFs::openRead("dir2/units.xml"); REQUIRE(file != nullptr); @@ -1210,7 +1210,7 @@ TEST_CASE("VirtFs1 openRead2") file = VirtFs::openRead("dir/brimmedhat.png"); REQUIRE(file == nullptr); - VirtFs::removeZipFromSearchPath(prefix + "test2.zip"); + VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); delete2(logger); @@ -1225,7 +1225,7 @@ TEST_CASE("VirtFs1 permitLinks") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPath(prefix + "data", + VirtFs::mountDir(prefix + "data", Append_false); const int cnt1 = VirtFs::exists("test/test2.txt") ? 26 : 25; @@ -1250,7 +1250,7 @@ TEST_CASE("VirtFs1 permitLinks") removeTemp(list); REQUIRE(list.size() == cnt1); - VirtFs::removeDirFromSearchPathSilent(prefix + "data"); + VirtFs::unmountDirSilent(prefix + "data"); VirtFs::deinit(); delete2(logger); } @@ -1264,7 +1264,7 @@ TEST_CASE("VirtFs1 read1") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPath(prefix + "data", + VirtFs::mountDir(prefix + "data", Append_false); VirtFile *file = VirtFs::openRead("test/test.txt"); @@ -1292,7 +1292,7 @@ TEST_CASE("VirtFs1 read1") VirtFs::close(file); free(buffer); - VirtFs::removeDirFromSearchPath(prefix + "data"); + VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); delete2(logger); } @@ -1306,7 +1306,7 @@ TEST_CASE("VirtFs1 read2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "test2.zip", + VirtFs::mountZip(prefix + "test2.zip", Append_false); VirtFile *file = nullptr; void *restrict buffer = nullptr; @@ -1423,7 +1423,7 @@ TEST_CASE("VirtFs1 read2") VirtFs::close(file); free(buffer); - VirtFs::removeZipFromSearchPath(prefix + "test2.zip"); + VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); delete2(logger); } diff --git a/src/fs/virtfs_unittest.cc b/src/fs/virtfs_unittest.cc index b3f07daa1..0ef26ae9f 100644 --- a/src/fs/virtfs_unittest.cc +++ b/src/fs/virtfs_unittest.cc @@ -53,8 +53,8 @@ TEST_CASE("VirtFs getUserDir") TEST_CASE("VirtFs exists1") { logger = new Logger(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); REQUIRE(VirtFs::exists("test") == true); REQUIRE(VirtFs::exists("test/dir1") == true); @@ -64,8 +64,8 @@ TEST_CASE("VirtFs exists1") REQUIRE(VirtFs::exists("tesQ/units.xml") == false); REQUIRE(VirtFs::exists("units.xml") == false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); REQUIRE(VirtFs::exists("test") == true); REQUIRE(VirtFs::exists("test/dir1") == true); @@ -75,8 +75,8 @@ TEST_CASE("VirtFs exists1") REQUIRE(VirtFs::exists("tesQ/units.xml") == false); REQUIRE(VirtFs::exists("units.xml") == true); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); REQUIRE(VirtFs::exists("test") == true); REQUIRE(VirtFs::exists("test/dir1") == true); @@ -86,8 +86,8 @@ TEST_CASE("VirtFs exists1") REQUIRE(VirtFs::exists("tesQ/units.xml") == false); REQUIRE(VirtFs::exists("units.xml") == false); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -99,7 +99,7 @@ TEST_CASE("VirtFs exists2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); REQUIRE(VirtFs::exists("test") == false); REQUIRE(VirtFs::exists("test/units.xml") == false); @@ -111,7 +111,7 @@ TEST_CASE("VirtFs exists2") REQUIRE(VirtFs::exists("units.xml.") == false); REQUIRE(VirtFs::exists("units.xml2") == false); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); delete2(logger); } @@ -123,8 +123,8 @@ TEST_CASE("VirtFs exists3") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); REQUIRE(VirtFs::exists("test") == false); REQUIRE(VirtFs::exists("test/units.xml") == false); @@ -138,8 +138,8 @@ TEST_CASE("VirtFs exists3") REQUIRE(VirtFs::exists("dir2/2") == false); REQUIRE(VirtFs::exists("dir2/paths.xml")); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); delete2(logger); } @@ -151,8 +151,8 @@ TEST_CASE("VirtFs exists4") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); - VirtFs::addDirToSearchPathSilent(prefix + "data/test", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); + VirtFs::mountDirSilent(prefix + "data/test", Append_false); REQUIRE(VirtFs::exists("test") == false); REQUIRE(VirtFs::exists("test/units.xml") == false); @@ -170,8 +170,8 @@ TEST_CASE("VirtFs exists4") REQUIRE(VirtFs::exists("dir2/file2.txt")); REQUIRE(VirtFs::exists("dir2/file3.txt") == false); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); - VirtFs::removeDirFromSearchPathSilent(prefix + "data/test"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); + VirtFs::unmountDirSilent(prefix + "data/test"); delete2(logger); } @@ -231,8 +231,8 @@ TEST_CASE("VirtFs enumerateFiles1") { logger = new Logger; - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); VirtList *list = nullptr; @@ -263,8 +263,8 @@ TEST_CASE("VirtFs enumerateFiles1") REQUIRE(list->names.size() == 0); VirtFs::freeList(list); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -272,9 +272,9 @@ TEST_CASE("VirtFs enumerateFiles2") { logger = new Logger; - VirtFs::addDirToSearchPathSilent("data/test/dir1", + VirtFs::mountDirSilent("data/test/dir1", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test/dir1", + VirtFs::mountDirSilent("../data/test/dir1", Append_false); VirtList *list = nullptr; @@ -284,8 +284,8 @@ TEST_CASE("VirtFs enumerateFiles2") REQUIRE(list->names.size() == 5); VirtFs::freeList(list); - VirtFs::removeDirFromSearchPathSilent("data/test/dir1"); - VirtFs::removeDirFromSearchPathSilent("../data/test/dir1"); + VirtFs::unmountDirSilent("data/test/dir1"); + VirtFs::unmountDirSilent("../data/test/dir1"); delete2(logger); } @@ -297,7 +297,7 @@ TEST_CASE("VirtFs enumerateFiles3") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); VirtList *list = nullptr; @@ -307,7 +307,7 @@ TEST_CASE("VirtFs enumerateFiles3") REQUIRE(inList(list, "dir")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); delete2(logger); } @@ -319,7 +319,7 @@ TEST_CASE("VirtFs enumerateFiles4") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); VirtList *list = nullptr; @@ -332,7 +332,7 @@ TEST_CASE("VirtFs enumerateFiles4") REQUIRE(inList(list, "units.xml")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); delete2(logger); } @@ -344,9 +344,9 @@ TEST_CASE("VirtFs enumerateFiles5") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); - VirtFs::addDirToSearchPathSilent(prefix + "data/test", Append_false); + VirtFs::mountDirSilent(prefix + "data/test", Append_false); VirtList *list = nullptr; @@ -359,16 +359,16 @@ TEST_CASE("VirtFs enumerateFiles5") REQUIRE(inList(list, "units.xml")); VirtFs::freeList(list); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); - VirtFs::removeDirFromSearchPathSilent(prefix + "data/test"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); + VirtFs::unmountDirSilent(prefix + "data/test"); delete2(logger); } TEST_CASE("VirtFs isDirectory1") { logger = new Logger(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); REQUIRE(VirtFs::isDirectory("test/units.xml/") == false); @@ -391,8 +391,8 @@ TEST_CASE("VirtFs isDirectory1") REQUIRE(VirtFs::isDirectory("testQ/") == false); REQUIRE(VirtFs::isDirectory("testQ//") == false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); REQUIRE(VirtFs::isDirectory("test/units.xml/") == false); @@ -404,8 +404,8 @@ TEST_CASE("VirtFs isDirectory1") REQUIRE(VirtFs::isDirectory("testQ") == false); REQUIRE(VirtFs::isDirectory("test/dir1") == true); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); REQUIRE(VirtFs::isDirectory("test/units123.xml") == false); @@ -417,8 +417,8 @@ TEST_CASE("VirtFs isDirectory1") REQUIRE(VirtFs::isDirectory("testQ") == false); REQUIRE(VirtFs::isDirectory("test/dir1") == true); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -430,7 +430,7 @@ TEST_CASE("VirtFs isDirectory2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); REQUIRE(VirtFs::isDirectory("dir") == true); @@ -440,7 +440,7 @@ TEST_CASE("VirtFs isDirectory2") REQUIRE(VirtFs::isDirectory("dir3") == false); REQUIRE(VirtFs::isDirectory("test.txt") == false); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); delete2(logger); } @@ -452,8 +452,8 @@ TEST_CASE("VirtFs isDirectory3") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPath(prefix + "data", Append_false); - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountDir(prefix + "data", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); REQUIRE(VirtFs::isDirectory("test/units.xml") == false); REQUIRE(VirtFs::isDirectory("test")); @@ -466,16 +466,16 @@ TEST_CASE("VirtFs isDirectory3") REQUIRE(VirtFs::isDirectory("test.txt") == false); REQUIRE(VirtFs::isDirectory("dir/hide.png") == false); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); + VirtFs::unmountDir(prefix + "data"); delete2(logger); } TEST_CASE("VirtFs openRead1") { logger = new Logger(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); VirtFile *file = nullptr; @@ -493,8 +493,8 @@ TEST_CASE("VirtFs openRead1") file = VirtFs::openRead("testQ"); REQUIRE(file == nullptr); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); file = VirtFs::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -511,8 +511,8 @@ TEST_CASE("VirtFs openRead1") file = VirtFs::openRead("testQ"); REQUIRE(file == nullptr); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); file = VirtFs::openRead("test/units.xml"); REQUIRE(file != nullptr); @@ -528,8 +528,8 @@ TEST_CASE("VirtFs openRead1") file = VirtFs::openRead("testQ"); REQUIRE(file == nullptr); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -541,7 +541,7 @@ TEST_CASE("VirtFs openRead2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); VirtFile *file = nullptr; @@ -557,7 +557,7 @@ TEST_CASE("VirtFs openRead2") REQUIRE(file != nullptr); VirtFs::close(file); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); delete2(logger); } @@ -569,8 +569,8 @@ TEST_CASE("VirtFs openRead3") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); - VirtFs::addDirToSearchPath(prefix + "data/test", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountDir(prefix + "data/test", Append_false); VirtFile *file = nullptr; @@ -591,8 +591,8 @@ TEST_CASE("VirtFs openRead3") file = VirtFs::openRead("dir/dye.pn_"); REQUIRE(file == nullptr); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); + VirtFs::unmountDir(prefix + "data/test"); delete2(logger); } @@ -602,8 +602,8 @@ TEST_CASE("VirtFs getRealDir1") const std::string sep = dirSeparator; REQUIRE(VirtFs::getRealDir(".") == ""); REQUIRE(VirtFs::getRealDir("..") == ""); - const bool dir1 = VirtFs::addDirToSearchPathSilent("data", Append_false); - REQUIRE((dir1 || VirtFs::addDirToSearchPathSilent("../data", Append_false)) + const bool dir1 = VirtFs::mountDirSilent("data", Append_false); + REQUIRE((dir1 || VirtFs::mountDirSilent("../data", Append_false)) == true); if (dir1 == true) { @@ -619,8 +619,8 @@ TEST_CASE("VirtFs getRealDir1") } REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); if (dir1 == true) { REQUIRE(VirtFs::getRealDir("test") == "data"); @@ -641,7 +641,7 @@ TEST_CASE("VirtFs getRealDir1") if (dir1 == true) { - VirtFs::addZipToSearchPath("data/test/test.zip", Append_false); + VirtFs::mountZip("data/test/test.zip", Append_false); REQUIRE(VirtFs::getRealDir("dir/brimmedhat.png") == "data" + sep + "test" + sep + "test.zip"); REQUIRE(VirtFs::getRealDir("hide.png") == @@ -649,15 +649,15 @@ TEST_CASE("VirtFs getRealDir1") } else { - VirtFs::addZipToSearchPath("../data/test/test.zip", Append_false); + VirtFs::mountZip("../data/test/test.zip", Append_false); REQUIRE(VirtFs::getRealDir("dir/brimmedhat.png") == ".." + sep + "data" + sep + "test" + sep + "test.zip"); REQUIRE(VirtFs::getRealDir("hide.png") == ".." + sep + "data" + sep + "test"); } - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); if (dir1 == true) { @@ -678,12 +678,12 @@ TEST_CASE("VirtFs getRealDir1") REQUIRE(VirtFs::exists("dir/hide.png")); REQUIRE(VirtFs::getRealDir("zzz") == ""); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); if (dir1 == true) - VirtFs::removeZipFromSearchPath("data/test/test.zip"); + VirtFs::unmountZip("data/test/test.zip"); else - VirtFs::removeZipFromSearchPath("../data/test/test.zip"); + VirtFs::unmountZip("../data/test/test.zip"); delete2(logger); } @@ -696,9 +696,9 @@ TEST_CASE("VirtFs getrealDir2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); - VirtFs::addDirToSearchPath(prefix + "data/test", Append_false); - VirtFs::addDirToSearchPath(prefix + "data", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountDir(prefix + "data/test", Append_false); + VirtFs::mountDir(prefix + "data", Append_false); REQUIRE(VirtFs::getRealDir("zzz") == ""); @@ -711,17 +711,17 @@ TEST_CASE("VirtFs getrealDir2") REQUIRE(VirtFs::getRealDir("dir/1//test.txt") == prefix + "data" + sep + "test" + sep + "test2.zip"); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); - VirtFs::removeDirFromSearchPath(prefix + "data"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); + VirtFs::unmountDir(prefix + "data/test"); + VirtFs::unmountDir(prefix + "data"); delete2(logger); } TEST_CASE("VirtFs permitLinks") { logger = new Logger(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); const int cnt1 = VirtFs::exists("test/test2.txt") ? 26 : 25; const int cnt2 = 26; @@ -745,16 +745,16 @@ TEST_CASE("VirtFs permitLinks") removeTemp(list); REQUIRE(list.size() == cnt1); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } TEST_CASE("VirtFs read1") { logger = new Logger(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); VirtFile *file = VirtFs::openRead("test/test.txt"); REQUIRE(file != nullptr); @@ -781,8 +781,8 @@ TEST_CASE("VirtFs read1") VirtFs::close(file); free(buffer); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -794,7 +794,7 @@ TEST_CASE("VirtFs read2") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); VirtFile *file = VirtFs::openRead("dir2/test.txt"); REQUIRE(file != nullptr); @@ -821,7 +821,7 @@ TEST_CASE("VirtFs read2") VirtFs::close(file); free(buffer); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); delete2(logger); } @@ -833,8 +833,8 @@ TEST_CASE("VirtFs read3") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test2.zip", Append_false); - VirtFs::addDirToSearchPath(prefix + "data", Append_false); + VirtFs::mountZip(prefix + "data/test/test2.zip", Append_false); + VirtFs::mountDir(prefix + "data", Append_false); VirtFile *file = VirtFs::openRead("dir2/test.txt"); REQUIRE(file != nullptr); @@ -861,8 +861,8 @@ TEST_CASE("VirtFs read3") VirtFs::close(file); free(buffer); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test2.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data"); + VirtFs::unmountZip(prefix + "data/test/test2.zip"); + VirtFs::unmountDir(prefix + "data"); delete2(logger); } @@ -874,8 +874,8 @@ TEST_CASE("VirtFs read4") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPath(prefix + "data/test", Append_true); - VirtFs::addZipToSearchPath(prefix + "data/test/test5.zip", Append_true); + VirtFs::mountDir(prefix + "data/test", Append_true); + VirtFs::mountZip(prefix + "data/test/test5.zip", Append_true); VirtFile *file = VirtFs::openRead("dir1/file1.txt"); REQUIRE(file != nullptr); @@ -902,8 +902,8 @@ TEST_CASE("VirtFs read4") VirtFs::close(file); free(buffer); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test5.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); + VirtFs::unmountZip(prefix + "data/test/test5.zip"); + VirtFs::unmountDir(prefix + "data/test"); delete2(logger); } @@ -915,8 +915,8 @@ TEST_CASE("VirtFs read5") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addZipToSearchPath(prefix + "data/test/test5.zip", Append_true); - VirtFs::addDirToSearchPath(prefix + "data/test", Append_true); + VirtFs::mountZip(prefix + "data/test/test5.zip", Append_true); + VirtFs::mountDir(prefix + "data/test", Append_true); VirtFile *file = VirtFs::openRead("dir1/file1.txt"); REQUIRE(file != nullptr); @@ -943,7 +943,7 @@ TEST_CASE("VirtFs read5") VirtFs::close(file); free(buffer); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test5.zip"); - VirtFs::removeDirFromSearchPath(prefix + "data/test"); + VirtFs::unmountZip(prefix + "data/test/test5.zip"); + VirtFs::unmountDir(prefix + "data/test"); delete2(logger); } diff --git a/src/fs/virtfstools.cpp b/src/fs/virtfstools.cpp index 0b434a340..9ba8c6683 100644 --- a/src/fs/virtfstools.cpp +++ b/src/fs/virtfstools.cpp @@ -83,7 +83,7 @@ namespace VirtFs { const std::string file = path + str; const std::string realPath = VirtFs::getRealDir(file); - VirtFs::addZipToSearchPath(std::string(realPath).append( + VirtFs::mountZip(std::string(realPath).append( dirSeparator).append(file), append); } } @@ -103,7 +103,7 @@ namespace VirtFs { const std::string file = path + str; const std::string realPath = VirtFs::getRealDir(file); - VirtFs::removeZipFromSearchPath(std::string( + VirtFs::unmountZip(std::string( realPath).append( dirSeparator).append( file)); diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc index cf74186b6..68342b241 100644 --- a/src/gui/widgets/browserbox_unittest.cc +++ b/src/gui/widgets/browserbox_unittest.cc @@ -52,8 +52,8 @@ TEST_CASE("BrowserBox tests", "browserbox") client = new Client; logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper; @@ -184,8 +184,8 @@ TEST_CASE("BrowserBox tests", "browserbox") Widget::setGlobalFont(nullptr); delete box; delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc index bf387ca43..8c4698af4 100644 --- a/src/gui/windowmanager_unittest.cc +++ b/src/gui/windowmanager_unittest.cc @@ -139,10 +139,10 @@ TEST_CASE("Windows tests", "windowmanager") ResourceManager::deleteInstance(); ResourceManager::init(); resourceManager->cleanOrphans(true); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); paths.setDefaultValues(getPathsDefaults()); branding.setValue("onlineServerFile", "test/serverlistplus.xml"); mainGraphics = new SDLGraphics; @@ -703,10 +703,10 @@ TEST_CASE("Windows tests", "windowmanager") delete2(playerHandler); delete2(gui); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); delete2(logger); // VirtFs::deinit(); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 9cc333667..2bff2e8cd 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -756,7 +756,7 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir) "/").append(name); if (!stat(fileName.c_str(), &statbuf)) { - VirtFs::addZipToSearchPath(fileName, + VirtFs::mountZip(fileName, Append_false); } } @@ -781,7 +781,7 @@ void UpdaterWindow::unloadManaPlusUpdates(const std::string &dir) const std::string file = std::string( fixPath).append("/").append(name); if (!stat(file.c_str(), &statbuf)) - VirtFs::removeZipFromSearchPath(file); + VirtFs::unmountZip(file); } } } @@ -793,27 +793,27 @@ void UpdaterWindow::addUpdateFile(const std::string &restrict path, { const std::string tmpPath = std::string(path).append("/").append(file); if (append == Append_false) - VirtFs::addZipToSearchPath(tmpPath, append); + VirtFs::mountZip(tmpPath, append); const std::string fixFile = std::string(fixPath).append("/").append(file); struct stat statbuf; if (!stat(fixFile.c_str(), &statbuf)) - VirtFs::addZipToSearchPath(fixFile, append); + VirtFs::mountZip(fixFile, append); if (append == Append_true) - VirtFs::addZipToSearchPath(tmpPath, append); + VirtFs::mountZip(tmpPath, append); } void UpdaterWindow::removeUpdateFile(const std::string &restrict path, const std::string &restrict fixPath, const std::string &restrict file) { - VirtFs::removeZipFromSearchPath( + VirtFs::unmountZip( std::string(path).append("/").append(file)); const std::string fixFile = std::string(fixPath).append("/").append(file); struct stat statbuf; if (!stat(fixFile.c_str(), &statbuf)) - VirtFs::removeZipFromSearchPath(fixFile); + VirtFs::unmountZip(fixFile); } void UpdaterWindow::logic() @@ -1139,7 +1139,7 @@ void UpdaterWindow::loadMods(const std::string &dir, "/").append(name); if (!stat(fileName.c_str(), &statbuf)) { - VirtFs::addZipToSearchPath(fileName, + VirtFs::mountZip(fileName, Append_false); } } @@ -1169,7 +1169,7 @@ void UpdaterWindow::loadDirMods(const std::string &dir) const std::string &localDir = mod->getLocalDir(); if (!localDir.empty()) { - VirtFs::addDirToSearchPath(dir + "/" + localDir, + VirtFs::mountDir(dir + "/" + localDir, Append_false); } } @@ -1193,7 +1193,7 @@ void UpdaterWindow::unloadMods(const std::string &dir) { const std::string &localDir = mod->getLocalDir(); if (!localDir.empty()) - VirtFs::removeDirFromSearchPath(dir + "/" + localDir); + VirtFs::unmountDir(dir + "/" + localDir); } } } diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc index 98138a3a9..a585570cd 100644 --- a/src/integrity_unittest.cc +++ b/src/integrity_unittest.cc @@ -121,8 +121,8 @@ TEST_CASE("integrity tests", "integrity") if (Files::existsLocal(name) == false) prefix = "../" + prefix; - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); #ifdef USE_SDL2 imageHelper = new SurfaceImageHelper; @@ -226,10 +226,10 @@ TEST_CASE("integrity tests", "integrity") SECTION("integrity Loader::getImage test 2") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); Image *const image = Loader::getImage( "dir/hide.png"); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(image != nullptr); REQUIRE(image->getSDLSurface() != nullptr); image->decRef(); @@ -237,10 +237,10 @@ TEST_CASE("integrity tests", "integrity") SECTION("integrity Loader::getImage test 3") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); Image *const image = Loader::getImage( "dir/brimmedhat.png"); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(image != nullptr); REQUIRE(image->getSDLSurface() != nullptr); image->decRef(); @@ -248,7 +248,7 @@ TEST_CASE("integrity tests", "integrity") SECTION("integrity Loader::getImage test 4") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); SDL_RWops *const rw = VirtFs::RWopsOpenRead(name1); if (!rw) @@ -260,17 +260,17 @@ TEST_CASE("integrity tests", "integrity") SDL_RWclose(rw); REQUIRE(sz == size1); SDL_RWclose(rw); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); - VirtFs::addDirToSearchPathSilent(prefix + "data/test", Append_true); + VirtFs::unmountZip(prefix + "data/test/test.zip"); + VirtFs::mountDirSilent(prefix + "data/test", Append_true); REQUIRE(compareBuffers(buf) == true); - VirtFs::removeDirFromSearchPathSilent(prefix + "data/test"); + VirtFs::unmountDirSilent(prefix + "data/test"); } #ifdef USE_PHYSFS SECTION("integrity Loader::getImage test 5") { - VirtFs::addZipToSearchPath("data/test/test.zip", Append_false); - VirtFs::addZipToSearchPath("../data/test/test.zip", Append_false); + VirtFs::mountZip("data/test/test.zip", Append_false); + VirtFs::mountZip("../data/test/test.zip", Append_false); PHYSFS_file *handle = PHYSFS_openRead(name1); REQUIRE(handle != nullptr); @@ -325,14 +325,14 @@ TEST_CASE("integrity tests", "integrity") // rw->close(rw); REQUIRE(PHYSFS_close(handle) != 0); - VirtFs::removeZipFromSearchPath("data/test/test.zip"); - VirtFs::removeZipFromSearchPath("../data/test/test.zip"); + VirtFs::unmountZip("data/test/test.zip"); + VirtFs::unmountZip("../data/test/test.zip"); } SECTION("integrity Loader::getImage test 6") { - VirtFs::addZipToSearchPath("data/test/test.zip", Append_false); - VirtFs::addZipToSearchPath("../data/test/test.zip", Append_false); + VirtFs::mountZip("data/test/test.zip", Append_false); + VirtFs::mountZip("../data/test/test.zip", Append_false); PHYSFS_file *handle = PHYSFS_openRead(name1); REQUIRE(handle != nullptr); @@ -405,19 +405,19 @@ TEST_CASE("integrity tests", "integrity") // rw->close(rw); REQUIRE(PHYSFS_close(handle) != 0); - VirtFs::removeZipFromSearchPath("data/test/test.zip"); - VirtFs::removeZipFromSearchPath("../data/test/test.zip"); - VirtFs::addDirToSearchPathSilent("data/test", Append_true); - VirtFs::addDirToSearchPathSilent("../data/test", Append_true); + VirtFs::unmountZip("data/test/test.zip"); + VirtFs::unmountZip("../data/test/test.zip"); + VirtFs::mountDirSilent("data/test", Append_true); + VirtFs::mountDirSilent("../data/test", Append_true); REQUIRE(compareBuffers(buf) == true); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); } #endif // USE_PHYSFS SECTION("integrity Loader::getImage test 7") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); SDL_RWops *const rw = VirtFs::RWopsOpenRead(name1); if (!rw) @@ -444,17 +444,17 @@ TEST_CASE("integrity tests", "integrity") REQUIRE(sz == size1); SDL_RWclose(rw); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); - VirtFs::addDirToSearchPathSilent("data/test", Append_true); - VirtFs::addDirToSearchPathSilent("../data/test", Append_true); + VirtFs::unmountZip(prefix + "data/test/test.zip"); + VirtFs::mountDirSilent("data/test", Append_true); + VirtFs::mountDirSilent("../data/test", Append_true); REQUIRE(compareBuffers(buf) == true); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); } SECTION("integrity Loader::getImage test 8") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); SDL_RWops *const rw = VirtFs::RWopsOpenRead(name1); if (!rw) @@ -467,31 +467,31 @@ TEST_CASE("integrity tests", "integrity") } SDL_Surface *const tmpImage = IMG_LoadPNG_RW(rw); SDL_RWclose(rw); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(tmpImage != nullptr); SDL_FreeSurface(tmpImage); } SECTION("integrity Loader::getImage test 9") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); SDL_RWops *const rw = VirtFs::RWopsOpenRead(name1); if (!rw) logger->log("Physfs error: %s", VirtFs::getLastError()); REQUIRE(rw != nullptr); Resource *const res = imageHelper->load(rw); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(res != nullptr); delete res; } SECTION("integrity Loader::getImage test 10") { - VirtFs::addZipToSearchPath(prefix + "data/test/test.zip", Append_false); + VirtFs::mountZip(prefix + "data/test/test.zip", Append_false); Image *const image = Loader::getImage( name1); - VirtFs::removeZipFromSearchPath(prefix + "data/test/test.zip"); + VirtFs::unmountZip(prefix + "data/test/test.zip"); REQUIRE(image != nullptr); REQUIRE(image->getSDLSurface() != nullptr); image->decRef(); @@ -502,8 +502,8 @@ TEST_CASE("integrity tests", "integrity") delete client; client = nullptr; - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/resources/dye/dye_unittest.cc b/src/resources/dye/dye_unittest.cc index a092357f5..62db73d09 100644 --- a/src/resources/dye/dye_unittest.cc +++ b/src/resources/dye/dye_unittest.cc @@ -2358,10 +2358,10 @@ TEST_CASE("Dye real dye") SDL_Init(SDL_INIT_VIDEO); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); #ifdef USE_SDL2 imageHelper = new SurfaceImageHelper; @@ -2393,10 +2393,10 @@ TEST_CASE("Dye real dye") dyeCheck("|A:#0000FFFF,FF000050", "arrow_up_A.png"); } delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/resources/dye/dyepalette_unittest.cc b/src/resources/dye/dyepalette_unittest.cc index f475e7dab..3305988e9 100644 --- a/src/resources/dye/dyepalette_unittest.cc +++ b/src/resources/dye/dyepalette_unittest.cc @@ -61,10 +61,10 @@ TEST_CASE("DyePalette tests") SDL_Init(SDL_INIT_VIDEO); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); @@ -392,10 +392,10 @@ TEST_CASE("DyePalette tests") REQUIRE(palette.mColors[0].value[3] == 0x77); } delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/resources/map/maplayer_unittest.cc b/src/resources/map/maplayer_unittest.cc index 58821682c..2bcbdbeae 100644 --- a/src/resources/map/maplayer_unittest.cc +++ b/src/resources/map/maplayer_unittest.cc @@ -1650,8 +1650,8 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)") { logger = new Logger; ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; #ifdef USE_SDL2 @@ -1994,8 +1994,8 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)") delete map; delete mock; GraphicsManager::deleteRenderers(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -2003,8 +2003,8 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)") { logger = new Logger; ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; #ifdef USE_SDL2 @@ -2353,8 +2353,8 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)") delete map; delete mock; GraphicsManager::deleteRenderers(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } @@ -2362,8 +2362,8 @@ TEST_CASE("MapLayer drawFringe") { logger = new Logger; ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; #ifdef USE_SDL2 @@ -3240,7 +3240,7 @@ TEST_CASE("MapLayer drawFringe") delete mock; delete2(theme); GraphicsManager::deleteRenderers(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } diff --git a/src/resources/map/speciallayer_unittest.cc b/src/resources/map/speciallayer_unittest.cc index cda761896..2e4e294c4 100644 --- a/src/resources/map/speciallayer_unittest.cc +++ b/src/resources/map/speciallayer_unittest.cc @@ -45,8 +45,8 @@ TEST_CASE("SpecialLayer updateCache") logger = new Logger; client = new Client; ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper; #ifdef USE_SDL2 @@ -262,7 +262,7 @@ TEST_CASE("SpecialLayer updateCache") delete layer; resourceManager->cleanOrphans(); delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); } diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc index ccb2a792a..d85202f32 100644 --- a/src/resources/resourcemanager/resourcemanager_unittest.cc +++ b/src/resources/resourcemanager/resourcemanager_unittest.cc @@ -95,8 +95,8 @@ TEST_CASE("resourcemanager", "resourcemanager") logger = new Logger(); ResourceManager::init(); ResourceManager *safeResman = resourceManager; - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper(); #ifdef USE_SDL2 @@ -659,8 +659,8 @@ TEST_CASE("resourcemanager", "resourcemanager") delete resourceManager; resourceManager = safeResman; delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/resources/sprite/animatedsprite_unittest.cc b/src/resources/sprite/animatedsprite_unittest.cc index 2a05a40bf..cefc99dc3 100644 --- a/src/resources/sprite/animatedsprite_unittest.cc +++ b/src/resources/sprite/animatedsprite_unittest.cc @@ -64,8 +64,8 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") SDL_Init(SDL_INIT_VIDEO); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); #ifdef USE_SDL2 @@ -191,8 +191,8 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") } delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/utils/chatutils_unittest.cc b/src/utils/chatutils_unittest.cc index 7b3dd251e..e343576fe 100644 --- a/src/utils/chatutils_unittest.cc +++ b/src/utils/chatutils_unittest.cc @@ -57,8 +57,8 @@ TEST_CASE("chatutils replaceVars") SDL_Init(SDL_INIT_VIDEO); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); theme = new Theme; Theme::selectSkin(); imageHelper = new SDLImageHelper(); @@ -247,8 +247,8 @@ TEST_CASE("chatutils replaceVars") delete2(actorManager); delete2(localPlayer); delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index cf0e880aa..dd60af3cd 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -1399,10 +1399,10 @@ TEST_CASE("stringuntils replaceItemLinks") { logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); ItemDB::NamedItemInfos &namedInfos = ItemDB::getNamedItemInfosTest(); ItemDB::ItemInfos &infos = ItemDB::getItemInfosTest(); @@ -1623,10 +1623,10 @@ TEST_CASE("stringuntils replaceItemLinks") delete_all(infos); infos.clear(); namedInfos.clear(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/utils/translation/poparser_unittest.cc b/src/utils/translation/poparser_unittest.cc index ff8370344..a296180f8 100644 --- a/src/utils/translation/poparser_unittest.cc +++ b/src/utils/translation/poparser_unittest.cc @@ -53,8 +53,8 @@ TEST_CASE("PoParser tests", "PoParser") client = new Client; logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); @@ -132,8 +132,8 @@ TEST_CASE("PoParser tests", "PoParser") delete dict; } delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } diff --git a/src/utils/xml_unittest.cc b/src/utils/xml_unittest.cc index 8cdebf86f..fc7818085 100644 --- a/src/utils/xml_unittest.cc +++ b/src/utils/xml_unittest.cc @@ -54,8 +54,8 @@ TEST_CASE("xml doc") XML::initXML(); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); #ifdef USE_SDL2 @@ -368,8 +368,8 @@ TEST_CASE("xml doc") } delete2(theme); delete2(client); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); diff --git a/src/utils/xmlutils_unittest.cc b/src/utils/xmlutils_unittest.cc index b28d3ec9d..41096bc05 100644 --- a/src/utils/xmlutils_unittest.cc +++ b/src/utils/xmlutils_unittest.cc @@ -44,8 +44,8 @@ TEST_CASE("xmlutils readXmlIntVector 1") XML::initXML(); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); @@ -78,8 +78,8 @@ TEST_CASE("xmlutils readXmlIntVector 1") REQUIRE(1 == arr[4]); delete2(client); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -90,8 +90,8 @@ TEST_CASE("xmlutils readXmlStringMap 1") XML::initXML(); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); @@ -123,8 +123,8 @@ TEST_CASE("xmlutils readXmlStringMap 1") REQUIRE(arr["Metal"] == "26"); delete2(client); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } @@ -135,10 +135,10 @@ TEST_CASE("xmlutils readXmlIntMap 1") XML::initXML(); logger = new Logger(); ResourceManager::init(); - VirtFs::addDirToSearchPathSilent("data", Append_false); - VirtFs::addDirToSearchPathSilent("../data", Append_false); - VirtFs::addDirToSearchPathSilent("data/test", Append_false); - VirtFs::addDirToSearchPathSilent("../data/test", Append_false); + VirtFs::mountDirSilent("data", Append_false); + VirtFs::mountDirSilent("../data", Append_false); + VirtFs::mountDirSilent("data/test", Append_false); + VirtFs::mountDirSilent("../data/test", Append_false); mainGraphics = new SDLGraphics; imageHelper = new SDLImageHelper(); @@ -170,10 +170,10 @@ TEST_CASE("xmlutils readXmlIntMap 1") REQUIRE(arr[3] == 0); delete2(client); ResourceManager::deleteInstance(); - VirtFs::removeDirFromSearchPathSilent("data/test"); - VirtFs::removeDirFromSearchPathSilent("../data/test"); - VirtFs::removeDirFromSearchPathSilent("data"); - VirtFs::removeDirFromSearchPathSilent("../data"); + VirtFs::unmountDirSilent("data/test"); + VirtFs::unmountDirSilent("../data/test"); + VirtFs::unmountDirSilent("data"); + VirtFs::unmountDirSilent("../data"); delete2(logger); // VirtFs::deinit(); } |