summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-11 19:08:11 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-11 19:19:38 +0300
commit245fb04a1e112cc8d0918a8660474299d5ce223c (patch)
treeeb5ab6266a4ff9551d2e08b9c14b61e353cd127f /src/gui
parentf978c1bed85961e102951340669ca873328bcef3 (diff)
downloadmanaverse-245fb04a1e112cc8d0918a8660474299d5ce223c.tar.gz
manaverse-245fb04a1e112cc8d0918a8660474299d5ce223c.tar.bz2
manaverse-245fb04a1e112cc8d0918a8660474299d5ce223c.tar.xz
manaverse-245fb04a1e112cc8d0918a8660474299d5ce223c.zip
Split virtfs api for add directories and archives.
Also remove useless resourcemanager functions for add/remove virtfs entries.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/browserbox_unittest.cc6
-rw-r--r--src/gui/windowmanager_unittest.cc8
-rw-r--r--src/gui/windows/updaterwindow.cpp26
3 files changed, 24 insertions, 16 deletions
diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc
index dfa9757b5..3978c309d 100644
--- a/src/gui/widgets/browserbox_unittest.cc
+++ b/src/gui/widgets/browserbox_unittest.cc
@@ -30,6 +30,8 @@
#include "gui/widgets/browserbox.h"
+#include "utils/virtfs.h"
+
#include "render/sdlgraphics.h"
#include "resources/resourcemanager/resourcemanager.h"
@@ -47,8 +49,8 @@ TEST_CASE("BrowserBox tests", "browserbox")
logger = new Logger();
imageHelper = new SDLImageHelper();
ResourceManager::init();
- resourceManager->addToSearchPath("data", Append_false);
- resourceManager->addToSearchPath("../data", Append_false);
+ VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPath("../data", Append_false);
mainGraphics = new SDLGraphics;
imageHelper = new SDLImageHelper;
diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc
index d3dc57b3e..392e6e872 100644
--- a/src/gui/windowmanager_unittest.cc
+++ b/src/gui/windowmanager_unittest.cc
@@ -138,10 +138,10 @@ TEST_CASE("Windows tests", "windowmanager")
resourceManager = nullptr;
ResourceManager::init();
resourceManager->cleanOrphans(true);
- resourceManager->addToSearchPath("data", Append_false);
- resourceManager->addToSearchPath("../data", Append_false);
- resourceManager->addToSearchPath("data/test", Append_false);
- resourceManager->addToSearchPath("../data/test", Append_false);
+ VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPath("../data", Append_false);
+ VirtFs::addDirToSearchPath("data/test", Append_false);
+ VirtFs::addDirToSearchPath("../data/test", Append_false);
paths.setDefaultValues(getPathsDefaults());
branding.setValue("onlineServerFile", "test/serverlistplus.xml");
mainGraphics = new SDLGraphics;
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 645ec0e84..70ddd6897 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -754,7 +754,10 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir)
std::string fileName = std::string(fixPath).append(
"/").append(name);
if (!stat(fileName.c_str(), &statbuf))
- resourceManager->addToSearchPath(fileName, Append_false);
+ {
+ VirtFs::addZipToSearchPath(fileName,
+ Append_false);
+ }
}
}
}
@@ -777,7 +780,7 @@ void UpdaterWindow::unloadManaPlusUpdates(const std::string &dir)
const std::string file = std::string(
fixPath).append("/").append(name);
if (!stat(file.c_str(), &statbuf))
- resourceManager->removeFromSearchPath(file);
+ VirtFs::removeZipFromSearchPath(file);
}
}
}
@@ -789,27 +792,27 @@ void UpdaterWindow::addUpdateFile(const std::string &restrict path,
{
const std::string tmpPath = std::string(path).append("/").append(file);
if (append == Append_false)
- resourceManager->addToSearchPath(tmpPath, append);
+ VirtFs::addZipToSearchPath(tmpPath, append);
const std::string fixFile = std::string(fixPath).append("/").append(file);
struct stat statbuf;
if (!stat(fixFile.c_str(), &statbuf))
- resourceManager->addToSearchPath(fixFile, append);
+ VirtFs::addZipToSearchPath(fixFile, append);
if (append == Append_false)
- resourceManager->addToSearchPath(tmpPath, append);
+ VirtFs::addZipToSearchPath(tmpPath, append);
}
void UpdaterWindow::removeUpdateFile(const std::string &restrict path,
const std::string &restrict fixPath,
const std::string &restrict file)
{
- resourceManager->removeFromSearchPath(
+ VirtFs::removeZipFromSearchPath(
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))
- resourceManager->removeFromSearchPath(fixFile);
+ VirtFs::removeZipFromSearchPath(fixFile);
}
void UpdaterWindow::logic()
@@ -1134,7 +1137,10 @@ void UpdaterWindow::loadMods(const std::string &dir,
std::string fileName = std::string(fixPath).append(
"/").append(name);
if (!stat(fileName.c_str(), &statbuf))
- resourceManager->addToSearchPath(fileName, Append_false);
+ {
+ VirtFs::addZipToSearchPath(fileName,
+ Append_false);
+ }
}
}
}
@@ -1162,7 +1168,7 @@ void UpdaterWindow::loadDirMods(const std::string &dir)
const std::string &localDir = mod->getLocalDir();
if (!localDir.empty())
{
- resourceManager->addToSearchPath(dir + "/" + localDir,
+ VirtFs::addDirToSearchPath(dir + "/" + localDir,
Append_false);
}
}
@@ -1186,7 +1192,7 @@ void UpdaterWindow::unloadMods(const std::string &dir)
{
const std::string &localDir = mod->getLocalDir();
if (!localDir.empty())
- resourceManager->removeFromSearchPath(dir + "/" + localDir);
+ VirtFs::removeDirFromSearchPath(dir + "/" + localDir);
}
}
}