diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-19 21:25:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-19 21:25:27 +0300 |
commit | 7225c69c5bf2de13d32d6e9a658779405c8e2707 (patch) | |
tree | 5fbd69d62ae8bd65b7b7a2e9986041aee4829888 /src/resources | |
parent | c0af9f41451d782b316feea8cf93fc50d4bd6733 (diff) | |
download | manaplus-7225c69c5bf2de13d32d6e9a658779405c8e2707.tar.gz manaplus-7225c69c5bf2de13d32d6e9a658779405c8e2707.tar.bz2 manaplus-7225c69c5bf2de13d32d6e9a658779405c8e2707.tar.xz manaplus-7225c69c5bf2de13d32d6e9a658779405c8e2707.zip |
Add strong typed bool enum Append.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/resourcemanager.cpp | 9 | ||||
-rw-r--r-- | src/resources/resourcemanager.h | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index b32126403..f9f55ca03 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -333,11 +333,12 @@ bool ResourceManager::setWriteDir(const std::string &path) const } bool ResourceManager::addToSearchPath(const std::string &path, - const bool append) const + const Append append) const { logger->log("Adding to PhysicsFS: %s (%s)", path.c_str(), - append ? "append" : "prepend"); - if (!PhysFs::addToSearchPath(path.c_str(), append ? 1 : 0)) + append == Append_true ? "append" : "prepend"); + if (!PhysFs::addToSearchPath(path.c_str(), + append == Append_true ? 1 : 0)) { logger->log("Error: %s", PHYSFS_getLastError()); return false; @@ -358,7 +359,7 @@ bool ResourceManager::removeFromSearchPath(const std::string &path) const void ResourceManager::searchAndAddArchives(const std::string &restrict path, const std::string &restrict ext, - const bool append) const + const Append append) const { const char *const dirSep = dirSeparator; char **list = PhysFs::enumerateFiles(path.c_str()); diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index c7c2cffe1..13d05f0b2 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -23,6 +23,8 @@ #ifndef RESOURCES_RESOURCEMANAGER_H #define RESOURCES_RESOURCEMANAGER_H +#include "enums/simpletypes/append.h" + #include "utils/stringvector.h" #include <map> @@ -78,7 +80,8 @@ class ResourceManager final * * @return <code>true</code> on success, <code>false</code> otherwise. */ - bool addToSearchPath(const std::string &path, const bool append) const; + bool addToSearchPath(const std::string &path, + const Append append) const; /** * Remove a directory or archive from the search path. @@ -92,7 +95,7 @@ class ResourceManager final */ void searchAndAddArchives(const std::string &restrict path, const std::string &restrict ext, - const bool append) const; + const Append append) const; /** * Searches for zip files and remove them from the search path. |