From 612873fa462d74a31bdd3977dac7919376038275 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 9 Mar 2017 03:31:42 +0300 Subject: Simplify add/remove dirs and zips methods in virtfs. --- src/gui/widgets/browserbox_unittest.cc | 8 ++++---- src/gui/windowmanager_unittest.cc | 16 ++++++++-------- src/gui/windows/updaterwindow.cpp | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/gui') 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); } } } -- cgit v1.2.3-60-g2f50