1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

VCMIDirs update #3

bfs = boost::filesystem;
- Updateting filenames (std::string -> bfs::path) #1
- Added platform detection, and some specyfic boost::filesystem includes
to Global.h
- Updated CBasicLogConfigurator. Now class uses bfs::path pathes.
This commit is contained in:
Karol
2014-08-10 23:42:39 +02:00
parent 5d5db77fc9
commit a302f6c7ad
10 changed files with 303 additions and 226 deletions

View File

@@ -69,7 +69,7 @@ void CFilesystemGenerator::loadDirectory(const std::string &mountPoint, const Js
std::string URI = prefix + config["path"].String();
int depth = 16;
if (!config["depth"].isNull())
depth = config["depth"].Float();
depth = (int)config["depth"].Float();
ResourceID resID(URI, EResType::DIRECTORY);
@@ -136,12 +136,13 @@ ISimpleResourceLoader * CResourceHandler::createInitial()
}
};
// TODO: CFilesystemLoader: Should take boost::filesystem::path in argument
for (auto & path : VCMIDirs::get().dataPaths())
{
if (boost::filesystem::is_directory(path)) // some of system-provided paths may not exist
initialLoader->addLoader(new CFilesystemLoader("", path, 0, true), false);
initialLoader->addLoader(new CFilesystemLoader("", path.string(), 0, true), false);
}
initialLoader->addLoader(new CFilesystemLoader("", VCMIDirs::get().userDataPath(), 0, true), false);
initialLoader->addLoader(new CFilesystemLoader("", VCMIDirs::get().userDataPath().string(), 0, true), false);
recurseInDir("CONFIG", 0);// look for configs
recurseInDir("DATA", 0); // look for archives
@@ -166,9 +167,10 @@ void CResourceHandler::initialize()
// |-saves
// |-config
// TODO: CFilesystemLoader should take boost::filesystem::path
knownLoaders["root"] = new CFilesystemList();
knownLoaders["saves"] = new CFilesystemLoader("SAVES/", VCMIDirs::get().userSavePath());
knownLoaders["config"] = new CFilesystemLoader("CONFIG/", VCMIDirs::get().userConfigPath());
knownLoaders["saves"] = new CFilesystemLoader("SAVES/", VCMIDirs::get().userSavePath().string());
knownLoaders["config"] = new CFilesystemLoader("CONFIG/", VCMIDirs::get().userConfigPath().string());
auto localFS = new CFilesystemList();
localFS->addLoader(knownLoaders["saves"], true);