diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index b2a523168..85fcdb924 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -554,7 +554,7 @@ void CModHandler::loadConfigFromFile (std::string name) std::string paths; for(auto& p : CResourceHandler::get()->getResourceNames(ResourceID("config/" + name))) { - paths += p + ", "; + paths += p.string() + ", "; } paths = paths.substr(0, paths.size() - 2); logGlobal->debugStream() << "Loading hardcoded features settings from [" << paths << "], result:"; diff --git a/lib/filesystem/AdapterLoaders.cpp b/lib/filesystem/AdapterLoaders.cpp index 9fa8a7101..26193b228 100644 --- a/lib/filesystem/AdapterLoaders.cpp +++ b/lib/filesystem/AdapterLoaders.cpp @@ -87,9 +87,9 @@ boost::optional CFilesystemList::getResourceName(const return boost::optional(); } -std::set CFilesystemList::getResourceNames(const ResourceID & resourceName) const +std::set CFilesystemList::getResourceNames(const ResourceID & resourceName) const { - std::set paths; + std::set paths; for(auto& loader : getResourcesWithName(resourceName)) { auto rn = loader->getResourceName(resourceName); diff --git a/lib/filesystem/AdapterLoaders.h b/lib/filesystem/AdapterLoaders.h index 51f9ce789..6b2db0592 100644 --- a/lib/filesystem/AdapterLoaders.h +++ b/lib/filesystem/AdapterLoaders.h @@ -1,87 +1,87 @@ -#pragma once - -/* - * AdapterLoaders.h, part of VCMI engine - * - * Authors: listed in file AUTHORS in main folder - * - * License: GNU General Public License v2.0 or later - * Full text of license available in license.txt file, in main folder - * - */ - -#include "ISimpleResourceLoader.h" -#include "ResourceID.h" - -class CFileInfo; -class CInputStream; -class JsonNode; - -/** - * Class that implements file mapping (aka *nix symbolic links) - * Uses json file as input, content is map: - * "fileA.txt" : "fileB.txt" - * Note that extension is necessary, but used only to determine type - * - * fileA - file which will be replaced - * fileB - file which will be used as replacement - */ -class DLL_LINKAGE CMappedFileLoader : public ISimpleResourceLoader -{ -public: - /** - * Ctor. - * - * @param config Specifies filesystem configuration - */ - explicit CMappedFileLoader(const std::string &mountPoint, const JsonNode & config); - - /// Interface implementation - /// @see ISimpleResourceLoader - std::unique_ptr load(const ResourceID & resourceName) const override; - bool existsResource(const ResourceID & resourceName) const override; - std::string getMountPoint() const override; - boost::optional getResourceName(const ResourceID & resourceName) const override; - std::unordered_set getFilteredFiles(std::function filter) const override; - -private: - /** A list of files in this map - * key = ResourceID for resource loader - * value = ResourceID to which file this request will be redirected - */ - std::unordered_map fileList; -}; - -class DLL_LINKAGE CFilesystemList : public ISimpleResourceLoader -{ - std::vector > loaders; - - std::set writeableLoaders; - - //FIXME: this is only compile fix, should be removed in the end - CFilesystemList(CFilesystemList &) = delete; - CFilesystemList &operator=(CFilesystemList &) = delete; +#pragma once -public: - CFilesystemList(); - ~CFilesystemList(); - /// Interface implementation - /// @see ISimpleResourceLoader - std::unique_ptr load(const ResourceID & resourceName) const override; - bool existsResource(const ResourceID & resourceName) const override; - std::string getMountPoint() const override; - boost::optional getResourceName(const ResourceID & resourceName) const override; - std::set getResourceNames(const ResourceID & resourceName) const override; - std::unordered_set getFilteredFiles(std::function filter) const override; - bool createResource(std::string filename, bool update = false) override; - std::vector getResourcesWithName(const ResourceID & resourceName) const override; - - /** - * Adds a resource loader to the loaders list - * Passes loader ownership to this object - * - * @param loader The simple resource loader object to add - * @param writeable - resource shall be treated as writeable - */ - void addLoader(ISimpleResourceLoader * loader, bool writeable); -}; +/* + * AdapterLoaders.h, part of VCMI engine + * + * Authors: listed in file AUTHORS in main folder + * + * License: GNU General Public License v2.0 or later + * Full text of license available in license.txt file, in main folder + * + */ + +#include "ISimpleResourceLoader.h" +#include "ResourceID.h" + +class CFileInfo; +class CInputStream; +class JsonNode; + +/** + * Class that implements file mapping (aka *nix symbolic links) + * Uses json file as input, content is map: + * "fileA.txt" : "fileB.txt" + * Note that extension is necessary, but used only to determine type + * + * fileA - file which will be replaced + * fileB - file which will be used as replacement + */ +class DLL_LINKAGE CMappedFileLoader : public ISimpleResourceLoader +{ +public: + /** + * Ctor. + * + * @param config Specifies filesystem configuration + */ + explicit CMappedFileLoader(const std::string &mountPoint, const JsonNode & config); + + /// Interface implementation + /// @see ISimpleResourceLoader + std::unique_ptr load(const ResourceID & resourceName) const override; + bool existsResource(const ResourceID & resourceName) const override; + std::string getMountPoint() const override; + boost::optional getResourceName(const ResourceID & resourceName) const override; + std::unordered_set getFilteredFiles(std::function filter) const override; + +private: + /** A list of files in this map + * key = ResourceID for resource loader + * value = ResourceID to which file this request will be redirected + */ + std::unordered_map fileList; +}; + +class DLL_LINKAGE CFilesystemList : public ISimpleResourceLoader +{ + std::vector > loaders; + + std::set writeableLoaders; + + //FIXME: this is only compile fix, should be removed in the end + CFilesystemList(CFilesystemList &) = delete; + CFilesystemList &operator=(CFilesystemList &) = delete; + +public: + CFilesystemList(); + ~CFilesystemList(); + /// Interface implementation + /// @see ISimpleResourceLoader + std::unique_ptr load(const ResourceID & resourceName) const override; + bool existsResource(const ResourceID & resourceName) const override; + std::string getMountPoint() const override; + boost::optional getResourceName(const ResourceID & resourceName) const override; + std::set getResourceNames(const ResourceID & resourceName) const override; + std::unordered_set getFilteredFiles(std::function filter) const override; + bool createResource(std::string filename, bool update = false) override; + std::vector getResourcesWithName(const ResourceID & resourceName) const override; + + /** + * Adds a resource loader to the loaders list + * Passes loader ownership to this object + * + * @param loader The simple resource loader object to add + * @param writeable - resource shall be treated as writeable + */ + void addLoader(ISimpleResourceLoader * loader, bool writeable); +}; diff --git a/lib/filesystem/ISimpleResourceLoader.h b/lib/filesystem/ISimpleResourceLoader.h index f7b663edc..5ee281942 100644 --- a/lib/filesystem/ISimpleResourceLoader.h +++ b/lib/filesystem/ISimpleResourceLoader.h @@ -58,9 +58,9 @@ public: * * @return std::set with names. */ - virtual std::set getResourceNames(const ResourceID & resourceName) const + virtual std::set getResourceNames(const ResourceID & resourceName) const { - std::set result; + std::set result; auto rn = getResourceName(resourceName); if(rn) {