summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager
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/resources/resourcemanager
parentf978c1bed85961e102951340669ca873328bcef3 (diff)
downloadplus-245fb04a1e112cc8d0918a8660474299d5ce223c.tar.gz
plus-245fb04a1e112cc8d0918a8660474299d5ce223c.tar.bz2
plus-245fb04a1e112cc8d0918a8660474299d5ce223c.tar.xz
plus-245fb04a1e112cc8d0918a8660474299d5ce223c.zip
Split virtfs api for add directories and archives.
Also remove useless resourcemanager functions for add/remove virtfs entries.
Diffstat (limited to 'src/resources/resourcemanager')
-rw-r--r--src/resources/resourcemanager/resourcemanager.cpp33
-rw-r--r--src/resources/resourcemanager/resourcemanager.h17
-rw-r--r--src/resources/resourcemanager/resourcemanager_unittest.cc4
3 files changed, 4 insertions, 50 deletions
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp
index 322b119a1..86158776d 100644
--- a/src/resources/resourcemanager/resourcemanager.cpp
+++ b/src/resources/resourcemanager/resourcemanager.cpp
@@ -340,35 +340,6 @@ bool ResourceManager::setWriteDir(const std::string &path) const
return static_cast<bool>(VirtFs::setWriteDir(path.c_str()));
}
-bool ResourceManager::addToSearchPath(const std::string &path,
- const Append append) const
-{
- logger->log("Adding to PhysicsFS: %s (%s)", path.c_str(),
- append == Append_true ? "append" : "prepend");
- if (!VirtFs::addToSearchPath(path.c_str(),
- append == Append_true ? 1 : 0))
- {
- logger->log("Error: %s: addToSearchPath failed: %s",
- path.c_str(),
- VirtFs::getLastError());
- return false;
- }
- return true;
-}
-
-bool ResourceManager::removeFromSearchPath(const std::string &path) const
-{
- logger->log("Removing from PhysicsFS: %s", path.c_str());
- if (!VirtFs::removeFromSearchPath(path.c_str()))
- {
- logger->log("Error: %s: removeFromSearchPath failed: %s",
- path.c_str(),
- VirtFs::getLastError());
- return false;
- }
- return true;
-}
-
void ResourceManager::searchAndAddArchives(const std::string &restrict path,
const std::string &restrict ext,
const Append append) const
@@ -385,7 +356,7 @@ void ResourceManager::searchAndAddArchives(const std::string &restrict path,
const std::string file = path + (*i);
const std::string realPath = std::string(
VirtFs::getRealDir(file.c_str()));
- addToSearchPath(std::string(realPath).append(
+ VirtFs::addZipToSearchPath(std::string(realPath).append(
dirSep).append(file), append);
}
}
@@ -408,7 +379,7 @@ void ResourceManager::searchAndRemoveArchives(const std::string &restrict path,
const std::string file = path + (*i);
const std::string realPath = std::string(
VirtFs::getRealDir(file.c_str()));
- removeFromSearchPath(std::string(realPath).append(
+ VirtFs::removeZipFromSearchPath(std::string(realPath).append(
dirSep).append(file));
}
}
diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h
index 58e74967f..6f6875361 100644
--- a/src/resources/resourcemanager/resourcemanager.h
+++ b/src/resources/resourcemanager/resourcemanager.h
@@ -68,23 +68,6 @@ class ResourceManager final : public MemoryCounter
bool setWriteDir(const std::string &path) const;
/**
- * Adds a directory or archive to the search path. If append is true
- * then the directory is added to the end of the search path, otherwise
- * it is added at the front.
- *
- * @return <code>true</code> on success, <code>false</code> otherwise.
- */
- bool addToSearchPath(const std::string &path,
- const Append append) const;
-
- /**
- * Remove a directory or archive from the search path.
- *
- * @return <code>true</code> on success, <code>false</code> otherwise.
- */
- bool removeFromSearchPath(const std::string &path) const;
-
- /**
* Searches for zip files and adds them to the search path.
*/
void searchAndAddArchives(const std::string &restrict path,
diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc
index 684f2d839..98ed0ca2f 100644
--- a/src/resources/resourcemanager/resourcemanager_unittest.cc
+++ b/src/resources/resourcemanager/resourcemanager_unittest.cc
@@ -94,8 +94,8 @@ TEST_CASE("resourcemanager", "resourcemanager")
logger = new Logger();
ResourceManager::init();
ResourceManager *safeResman = resourceManager;
- resourceManager->addToSearchPath("data", Append_false);
- resourceManager->addToSearchPath("../data", Append_false);
+ VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPath("../data", Append_false);
imageHelper = new SDLImageHelper();
#ifdef USE_SDL2