1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

basic subdirectory support

This commit is contained in:
Michael
2023-08-06 21:39:39 +02:00
committed by GitHub
parent ad8695ac91
commit a9e895c08f
2 changed files with 5 additions and 1 deletions

View File

@@ -85,6 +85,10 @@ bool CFilesystemLoader::createResource(std::string filename, bool update)
if (!update)
{
// create folders if not exists
boost::filesystem::path p((baseDirectory / filename).c_str());
boost::filesystem::create_directories(p.parent_path());
// create file, if not exists
std::ofstream file((baseDirectory / filename).c_str(), std::ofstream::binary);

View File

@@ -147,7 +147,7 @@ ISimpleResourceLoader * CResourceHandler::createInitial()
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, 1, true), false);
}
initialLoader->addLoader(new CFilesystemLoader("", VCMIDirs::get().userDataPath(), 0, true), false);