mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
Reorganization of boost filesystem usage
- Removed (most of) boost filesystem namespace usings - Replaced boost::filesystem::fstream with std::fstream and different constructor that should be available on any plaftorm
This commit is contained in:
parent
21a39f0b01
commit
4d08a131d3
@ -50,7 +50,6 @@
|
||||
|
||||
namespace po = boost::program_options;
|
||||
namespace po_style = boost::program_options::command_line_style;
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
extern boost::thread_specific_ptr<bool> inGuiThread;
|
||||
|
||||
@ -196,7 +195,7 @@ int main(int argc, char * argv[])
|
||||
console->start();
|
||||
#endif
|
||||
|
||||
const bfs::path logPath = VCMIDirs::get().userLogsPath() / "VCMI_Client_log.txt";
|
||||
const boost::filesystem::path logPath = VCMIDirs::get().userLogsPath() / "VCMI_Client_log.txt";
|
||||
logConfig = new CBasicLogConfigurator(logPath, console);
|
||||
logConfig->configureDefault();
|
||||
logGlobal->info("Starting client of '%s'", GameConstants::VCMI_VERSION);
|
||||
|
@ -247,7 +247,7 @@ void ClientCommandManager::handleGetConfigCommand()
|
||||
boost::algorithm::replace_all(name, ":", "_");
|
||||
|
||||
const boost::filesystem::path filePath = contentOutPath / (name + ".json");
|
||||
boost::filesystem::ofstream file(filePath);
|
||||
std::ofstream file(filePath.c_str());
|
||||
file << object.toJson();
|
||||
}
|
||||
}
|
||||
@ -273,7 +273,7 @@ void ClientCommandManager::handleGetScriptsCommand()
|
||||
|
||||
const scripting::ScriptImpl * script = kv.second.get();
|
||||
boost::filesystem::path filePath = outPath / (name + ".lua");
|
||||
boost::filesystem::ofstream file(filePath);
|
||||
std::ofstream file(filePath.c_str());
|
||||
file << script->getSource();
|
||||
}
|
||||
printCommandMessage("\rExtracting done :)\n");
|
||||
@ -300,7 +300,7 @@ void ClientCommandManager::handleGetTextCommand()
|
||||
|
||||
boost::filesystem::create_directories(filePath.parent_path());
|
||||
|
||||
boost::filesystem::ofstream file(filePath);
|
||||
std::ofstream file(filePath.c_str());
|
||||
auto text = CResourceHandler::get()->load(filename)->readAll();
|
||||
|
||||
file.write((char*)text.first.get(), text.second);
|
||||
@ -331,7 +331,7 @@ void ClientCommandManager::handleExtractCommand(std::istringstream& singleWordBu
|
||||
auto data = CResourceHandler::get()->load(ResourceID(URI))->readAll();
|
||||
|
||||
boost::filesystem::create_directories(outPath.parent_path());
|
||||
boost::filesystem::ofstream outFile(outPath, boost::filesystem::ofstream::binary);
|
||||
std::ofstream outFile(outPath.c_str(), std::ofstream::binary);
|
||||
outFile.write((char*)data.first.get(), data.second);
|
||||
}
|
||||
else
|
||||
|
@ -61,8 +61,6 @@
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
std::shared_ptr<CMainMenu> CMM;
|
||||
ISelectionScreenInfo * SEL;
|
||||
|
||||
|
@ -113,7 +113,7 @@ JsonNode toJson(QVariant object)
|
||||
|
||||
void JsonToFile(QString filename, QVariant object)
|
||||
{
|
||||
boost::filesystem::fstream file(qstringToPath(filename), std::ios::out | std::ios_base::binary);
|
||||
std::fstream file(qstringToPath(filename).c_str(), std::ios::out | std::ios_base::binary);
|
||||
file << toJson(object).toJson();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void SettingsStorage::invalidateNode(const std::vector<std::string> &changedPath
|
||||
savedConf.Struct().erase("session");
|
||||
JsonUtils::minimize(savedConf, "vcmi:settings");
|
||||
|
||||
boost::filesystem::fstream file(*CResourceHandler::get()->getResourceName(ResourceID("config/settings.json")), std::ofstream::out | std::ofstream::trunc);
|
||||
std::fstream file(CResourceHandler::get()->getResourceName(ResourceID("config/settings.json"))->c_str(), std::ofstream::out | std::ofstream::trunc);
|
||||
file << savedConf.toJson();
|
||||
}
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ void CModHandler::afterLoad(bool onlyEssential)
|
||||
|
||||
if(!onlyEssential)
|
||||
{
|
||||
boost::filesystem::fstream file(*CResourceHandler::get()->getResourceName(ResourceID("config/modSettings.json")), std::ofstream::out | std::ofstream::trunc);
|
||||
std::fstream file(CResourceHandler::get()->getResourceName(ResourceID("config/modSettings.json"))->c_str(), std::ofstream::out | std::ofstream::trunc);
|
||||
file << modSettings.toJson();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ ArchiveEntry::ArchiveEntry()
|
||||
|
||||
}
|
||||
|
||||
CArchiveLoader::CArchiveLoader(std::string _mountPoint, bfs::path _archive, bool _extractArchives) :
|
||||
CArchiveLoader::CArchiveLoader(std::string _mountPoint, boost::filesystem::path _archive, bool _extractArchives) :
|
||||
archive(std::move(_archive)),
|
||||
mountPoint(std::move(_mountPoint)),
|
||||
extractArchives(_extractArchives)
|
||||
@ -217,7 +217,7 @@ void CArchiveLoader::extractToFolder(const std::string & outputSubFolder, CInput
|
||||
fileStream.seek(entry.offset);
|
||||
fileStream.read(data.data(), entry.fullSize);
|
||||
|
||||
bfs::path extractedFilePath = createExtractedFilePath(outputSubFolder, entry.name);
|
||||
boost::filesystem::path extractedFilePath = createExtractedFilePath(outputSubFolder, entry.name);
|
||||
|
||||
// writeToOutputFile
|
||||
std::ofstream out(extractedFilePath.string(), std::ofstream::binary);
|
||||
@ -235,12 +235,12 @@ void CArchiveLoader::extractToFolder(const std::string & outputSubFolder, const
|
||||
extractToFolder(outputSubFolder, *inputStream, entry);
|
||||
}
|
||||
|
||||
bfs::path createExtractedFilePath(const std::string & outputSubFolder, const std::string & entryName)
|
||||
boost::filesystem::path createExtractedFilePath(const std::string & outputSubFolder, const std::string & entryName)
|
||||
{
|
||||
bfs::path extractionFolderPath = VCMIDirs::get().userExtractedPath() / outputSubFolder;
|
||||
bfs::path extractedFilePath = extractionFolderPath / entryName;
|
||||
boost::filesystem::path extractionFolderPath = VCMIDirs::get().userExtractedPath() / outputSubFolder;
|
||||
boost::filesystem::path extractedFilePath = extractionFolderPath / entryName;
|
||||
|
||||
bfs::create_directories(extractionFolderPath);
|
||||
boost::filesystem::create_directories(extractionFolderPath);
|
||||
|
||||
return extractedFilePath;
|
||||
}
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "ISimpleResourceLoader.h"
|
||||
#include "ResourceID.h"
|
||||
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class CFileInputStream;
|
||||
@ -58,7 +56,7 @@ public:
|
||||
*
|
||||
* @throws std::runtime_error if the archive wasn't found or if the archive isn't supported
|
||||
*/
|
||||
CArchiveLoader(std::string mountPoint, bfs::path archive, bool extractArchives = false);
|
||||
CArchiveLoader(std::string mountPoint, boost::filesystem::path archive, bool extractArchives = false);
|
||||
|
||||
/// Interface implementation
|
||||
/// @see ISimpleResourceLoader
|
||||
@ -95,7 +93,7 @@ private:
|
||||
void initSNDArchive(const std::string &mountPoint, CFileInputStream & fileStream);
|
||||
|
||||
/** The file path to the archive which is scanned and indexed. */
|
||||
bfs::path archive;
|
||||
boost::filesystem::path archive;
|
||||
|
||||
std::string mountPoint;
|
||||
|
||||
@ -107,6 +105,6 @@ private:
|
||||
};
|
||||
|
||||
/** Constructs the file path for the extracted file. Creates the subfolder hierarchy aswell **/
|
||||
bfs::path createExtractedFilePath(const std::string & outputSubFolder, const std::string & entryName);
|
||||
boost::filesystem::path createExtractedFilePath(const std::string & outputSubFolder, const std::string & entryName);
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -15,7 +15,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
CFileInputStream::CFileInputStream(const boost::filesystem::path & file, si64 start, si64 size)
|
||||
: dataStart{start},
|
||||
dataSize{size},
|
||||
fileStream{file, std::ios::in | std::ios::binary}
|
||||
fileStream{file.c_str(), std::ios::in | std::ios::binary}
|
||||
{
|
||||
if (fileStream.fail())
|
||||
throw std::runtime_error("File " + file.string() + " isn't available.");
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
si64 dataSize;
|
||||
|
||||
/** Native c++ input file stream object. */
|
||||
boost::filesystem::fstream fileStream;
|
||||
std::fstream fileStream;
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -14,9 +14,7 @@
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
CFilesystemLoader::CFilesystemLoader(std::string _mountPoint, bfs::path baseDirectory, size_t depth, bool initial):
|
||||
CFilesystemLoader::CFilesystemLoader(std::string _mountPoint, boost::filesystem::path baseDirectory, size_t depth, bool initial):
|
||||
baseDirectory(std::move(baseDirectory)),
|
||||
mountPoint(std::move(_mountPoint)),
|
||||
fileList(listFiles(mountPoint, depth, initial)),
|
||||
@ -28,7 +26,7 @@ CFilesystemLoader::CFilesystemLoader(std::string _mountPoint, bfs::path baseDire
|
||||
std::unique_ptr<CInputStream> CFilesystemLoader::load(const ResourceID & resourceName) const
|
||||
{
|
||||
assert(fileList.count(resourceName));
|
||||
bfs::path file = baseDirectory / fileList.at(resourceName);
|
||||
boost::filesystem::path file = baseDirectory / fileList.at(resourceName);
|
||||
logGlobal->trace("loading %s", file.string());
|
||||
return std::make_unique<CFileInputStream>(file);
|
||||
}
|
||||
@ -88,7 +86,7 @@ bool CFilesystemLoader::createResource(std::string filename, bool update)
|
||||
if (!update)
|
||||
{
|
||||
// create file, if not exists
|
||||
boost::filesystem::fstream file(baseDirectory / filename);
|
||||
std::fstream file((baseDirectory / filename).c_str());
|
||||
|
||||
if (!file.is_open())
|
||||
return false;
|
||||
@ -97,7 +95,7 @@ bool CFilesystemLoader::createResource(std::string filename, bool update)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unordered_map<ResourceID, bfs::path> CFilesystemLoader::listFiles(const std::string &mountPoint, size_t depth, bool initial) const
|
||||
std::unordered_map<ResourceID, boost::filesystem::path> CFilesystemLoader::listFiles(const std::string &mountPoint, size_t depth, bool initial) const
|
||||
{
|
||||
static const EResType::Type initArray[] = {
|
||||
EResType::DIRECTORY,
|
||||
@ -108,16 +106,16 @@ std::unordered_map<ResourceID, bfs::path> CFilesystemLoader::listFiles(const std
|
||||
EResType::ARCHIVE_ZIP };
|
||||
static const std::set<EResType::Type> initialTypes(initArray, initArray + std::size(initArray));
|
||||
|
||||
assert(bfs::is_directory(baseDirectory));
|
||||
std::unordered_map<ResourceID, bfs::path> fileList;
|
||||
assert(boost::filesystem::is_directory(baseDirectory));
|
||||
std::unordered_map<ResourceID, boost::filesystem::path> fileList;
|
||||
|
||||
std::vector<bfs::path> path; //vector holding relative path to our file
|
||||
std::vector<boost::filesystem::path> path; //vector holding relative path to our file
|
||||
|
||||
bfs::recursive_directory_iterator enddir;
|
||||
boost::filesystem::recursive_directory_iterator enddir;
|
||||
#if BOOST_VERSION >= 107200 // 1.72
|
||||
bfs::recursive_directory_iterator it(baseDirectory, bfs::directory_options::follow_directory_symlink);
|
||||
boost::filesystem::recursive_directory_iterator it(baseDirectory, boost::filesystem::directory_options::follow_directory_symlink);
|
||||
#else
|
||||
bfs::recursive_directory_iterator it(baseDirectory, bfs::symlink_option::recurse);
|
||||
boost::filesystem::recursive_directory_iterator it(baseDirectory, boost::filesystem::symlink_option::recurse);
|
||||
#endif
|
||||
|
||||
for(; it != enddir; ++it)
|
||||
@ -129,7 +127,7 @@ std::unordered_map<ResourceID, bfs::path> CFilesystemLoader::listFiles(const std
|
||||
const auto currentDepth = it.level();
|
||||
#endif
|
||||
|
||||
if (bfs::is_directory(it->status()))
|
||||
if (boost::filesystem::is_directory(it->status()))
|
||||
{
|
||||
path.resize(currentDepth + 1);
|
||||
path.back() = it->path().filename();
|
||||
@ -148,7 +146,7 @@ std::unordered_map<ResourceID, bfs::path> CFilesystemLoader::listFiles(const std
|
||||
if (!initial || vstd::contains(initialTypes, type))
|
||||
{
|
||||
//reconstruct relative filename (not possible via boost AFAIK)
|
||||
bfs::path filename;
|
||||
boost::filesystem::path filename;
|
||||
const size_t iterations = std::min(static_cast<size_t>(currentDepth), path.size());
|
||||
if (iterations)
|
||||
{
|
||||
@ -161,13 +159,13 @@ std::unordered_map<ResourceID, bfs::path> CFilesystemLoader::listFiles(const std
|
||||
filename = it->path().filename();
|
||||
|
||||
std::string resName;
|
||||
if (bfs::path::preferred_separator != '/')
|
||||
if (boost::filesystem::path::preferred_separator != '/')
|
||||
{
|
||||
// resource names are using UNIX slashes (/)
|
||||
resName.reserve(resName.size() + filename.native().size());
|
||||
resName = mountPoint;
|
||||
for (const char c : filename.string())
|
||||
if (c != bfs::path::preferred_separator)
|
||||
if (c != boost::filesystem::path::preferred_separator)
|
||||
resName.push_back(c);
|
||||
else
|
||||
resName.push_back('/');
|
||||
|
@ -214,7 +214,7 @@ bool ZipArchive::extract(const boost::filesystem::path & from, const boost::file
|
||||
if (boost::algorithm::ends_with(file, "/"))
|
||||
continue;
|
||||
|
||||
boost::filesystem::fstream destFile(fullName, std::ios::out | std::ios::binary);
|
||||
std::fstream destFile(fullName.c_str(), std::ios::out | std::ios::binary);
|
||||
if (!destFile.good())
|
||||
return false;
|
||||
|
||||
|
@ -425,7 +425,7 @@ const CColorMapping & CLogConsoleTarget::getColorMapping() const { return colorM
|
||||
void CLogConsoleTarget::setColorMapping(const CColorMapping & colorMapping) { this->colorMapping = colorMapping; }
|
||||
|
||||
CLogFileTarget::CLogFileTarget(const boost::filesystem::path & filePath, bool append):
|
||||
file(filePath, append ? std::ios_base::app : std::ios_base::out)
|
||||
file(filePath.c_str(), append ? std::ios_base::app : std::ios_base::out)
|
||||
{
|
||||
// formatter.setPattern("%d %l %n [%t] - %m");
|
||||
formatter.setPattern("%l %n [%t] - %m");
|
||||
|
@ -219,7 +219,7 @@ public:
|
||||
void write(const LogRecord & record) override;
|
||||
|
||||
private:
|
||||
boost::filesystem::fstream file;
|
||||
std::fstream file;
|
||||
CLogFormatter formatter;
|
||||
mutable std::mutex mx;
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ void CMapService::saveMap(const std::unique_ptr<CMap> & map, boost::filesystem::
|
||||
}
|
||||
{
|
||||
boost::filesystem::remove(fullPath);
|
||||
boost::filesystem::ofstream tmp(fullPath, boost::filesystem::ofstream::binary);
|
||||
std::ofstream tmp(fullPath.c_str(), std::ofstream::binary);
|
||||
|
||||
tmp.write(reinterpret_cast<const char *>(serializeBuffer.getBuffer().data()), serializeBuffer.getSize());
|
||||
tmp.flush();
|
||||
|
@ -40,7 +40,7 @@ void CLoadFile::openNextFile(const boost::filesystem::path & fname, int minimalV
|
||||
try
|
||||
{
|
||||
fName = fname.string();
|
||||
sfile = std::make_unique<boost::filesystem::fstream>(fname, std::ios::in | std::ios::binary);
|
||||
sfile = std::make_unique<std::fstream>(fname.c_str(), std::ios::in | std::ios::binary);
|
||||
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
|
||||
|
||||
if(!(*sfile))
|
||||
|
@ -580,7 +580,7 @@ public:
|
||||
BinaryDeserializer serializer;
|
||||
|
||||
std::string fName;
|
||||
std::unique_ptr<boost::filesystem::fstream> sfile;
|
||||
std::unique_ptr<std::fstream> sfile;
|
||||
|
||||
CLoadFile(const boost::filesystem::path & fname, int minimalVersion = SERIALIZATION_VERSION); //throws!
|
||||
virtual ~CLoadFile();
|
||||
|
@ -37,7 +37,7 @@ void CSaveFile::openNextFile(const boost::filesystem::path &fname)
|
||||
fName = fname;
|
||||
try
|
||||
{
|
||||
sfile = std::make_unique<boost::filesystem::fstream>(fname, std::ios::out | std::ios::binary);
|
||||
sfile = std::make_unique<std::fstream>(fname.c_str(), std::ios::out | std::ios::binary);
|
||||
sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway
|
||||
|
||||
if(!(*sfile))
|
||||
|
@ -390,7 +390,7 @@ public:
|
||||
BinarySerializer serializer;
|
||||
|
||||
boost::filesystem::path fName;
|
||||
std::unique_ptr<boost::filesystem::fstream> sfile;
|
||||
std::unique_ptr<std::fstream> sfile;
|
||||
|
||||
CSaveFile(const boost::filesystem::path &fname); //throws!
|
||||
~CSaveFile();
|
||||
|
@ -119,7 +119,7 @@ JsonNode toJson(QVariant object)
|
||||
|
||||
void JsonToFile(QString filename, QVariant object)
|
||||
{
|
||||
boost::filesystem::fstream file(qstringToPath(filename), std::ios::out | std::ios_base::binary);
|
||||
std::fstream file(qstringToPath(filename).c_str(), std::ios::out | std::ios_base::binary);
|
||||
file << toJson(object).toJson();
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
void ResourceConverter::convertExtractedResourceFiles(ConversionOptions conversionOptions)
|
||||
{
|
||||
bfs::path spritesPath = VCMIDirs::get().userExtractedPath() / "SPRITES";
|
||||
bfs::path imagesPath = VCMIDirs::get().userExtractedPath() / "IMAGES";
|
||||
boost::filesystem::path spritesPath = VCMIDirs::get().userExtractedPath() / "SPRITES";
|
||||
boost::filesystem::path imagesPath = VCMIDirs::get().userExtractedPath() / "IMAGES";
|
||||
std::vector<std::string> defFiles = { "TwCrPort.def", "CPRSMALL.def", "FlagPort.def", "ITPA.def", "ITPt.def", "Un32.def", "Un44.def" };
|
||||
|
||||
if(conversionOptions.splitDefs)
|
||||
@ -35,16 +35,16 @@ void ResourceConverter::convertExtractedResourceFiles(ConversionOptions conversi
|
||||
doConvertPcxToPng(imagesPath, conversionOptions.deleteOriginals);
|
||||
}
|
||||
|
||||
void ResourceConverter::doConvertPcxToPng(const bfs::path & sourceFolder, bool deleteOriginals)
|
||||
void ResourceConverter::doConvertPcxToPng(const boost::filesystem::path & sourceFolder, bool deleteOriginals)
|
||||
{
|
||||
logGlobal->info("Converting .pcx to .png from folder: %s ...\n", sourceFolder);
|
||||
|
||||
for(const auto & directoryEntry : bfs::directory_iterator(sourceFolder))
|
||||
for(const auto & directoryEntry : boost::filesystem::directory_iterator(sourceFolder))
|
||||
{
|
||||
const auto filename = directoryEntry.path().filename();
|
||||
try
|
||||
{
|
||||
if(!bfs::is_regular_file(directoryEntry))
|
||||
if(!boost::filesystem::is_regular_file(directoryEntry))
|
||||
continue;
|
||||
|
||||
std::string fileStem = directoryEntry.path().stem().string();
|
||||
@ -53,11 +53,11 @@ void ResourceConverter::doConvertPcxToPng(const bfs::path & sourceFolder, bool d
|
||||
if(boost::algorithm::to_lower_copy(filename.extension().string()) == ".pcx")
|
||||
{
|
||||
auto img = BitmapHandler::loadBitmap(filenameLowerCase);
|
||||
bfs::path pngFilePath = sourceFolder / (fileStem + ".png");
|
||||
boost::filesystem::path pngFilePath = sourceFolder / (fileStem + ".png");
|
||||
img.save(pathToQString(pngFilePath), "PNG");
|
||||
|
||||
if(deleteOriginals)
|
||||
bfs::remove(directoryEntry.path());
|
||||
boost::filesystem::remove(directoryEntry.path());
|
||||
}
|
||||
}
|
||||
catch(const std::exception& ex)
|
||||
@ -67,7 +67,7 @@ void ResourceConverter::doConvertPcxToPng(const bfs::path & sourceFolder, bool d
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceConverter::splitDefFile(const std::string & fileName, const bfs::path & sourceFolder, bool deleteOriginals)
|
||||
void ResourceConverter::splitDefFile(const std::string & fileName, const boost::filesystem::path & sourceFolder, bool deleteOriginals)
|
||||
{
|
||||
if(CResourceHandler::get()->existsResource(ResourceID("SPRITES/" + fileName)))
|
||||
{
|
||||
@ -76,13 +76,13 @@ void ResourceConverter::splitDefFile(const std::string & fileName, const bfs::pa
|
||||
anim->exportBitmaps(pathToQString(sourceFolder));
|
||||
|
||||
if(deleteOriginals)
|
||||
bfs::remove(sourceFolder / fileName);
|
||||
boost::filesystem::remove(sourceFolder / fileName);
|
||||
}
|
||||
else
|
||||
logGlobal->error("Def File Split error! " + fileName);
|
||||
}
|
||||
|
||||
void ResourceConverter::splitDefFiles(const std::vector<std::string> & defFileNames, const bfs::path & sourceFolder, bool deleteOriginals)
|
||||
void ResourceConverter::splitDefFiles(const std::vector<std::string> & defFileNames, const boost::filesystem::path & sourceFolder, bool deleteOriginals)
|
||||
{
|
||||
logGlobal->info("Splitting Def Files from folder: %s ...\n", sourceFolder);
|
||||
|
||||
|
@ -9,8 +9,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
// Struct for holding all Convertor Options
|
||||
struct ConversionOptions
|
||||
{
|
||||
@ -45,14 +43,14 @@ public:
|
||||
private:
|
||||
|
||||
// Converts all .pcx from extractedFolder/Images into .png
|
||||
static void doConvertPcxToPng(const bfs::path & sourceFolder, bool deleteOriginals);
|
||||
static void doConvertPcxToPng(const boost::filesystem::path & sourceFolder, bool deleteOriginals);
|
||||
|
||||
// splits a .def file into individual images and converts the output to PNG format
|
||||
static void splitDefFile(const std::string & fileName, const bfs::path & sourceFolder, bool deleteOriginals);
|
||||
static void splitDefFile(const std::string & fileName, const boost::filesystem::path & sourceFolder, bool deleteOriginals);
|
||||
|
||||
/// <summary>
|
||||
/// Splits the given .def files into individual images.
|
||||
/// For each .def file, the resulting images will be output in the same folder, in a subfolder (named just like the .def file)
|
||||
/// </summary>
|
||||
static void splitDefFiles(const std::vector<std::string> & defFileNames, const bfs::path & sourceFolder, bool deleteOriginals);
|
||||
static void splitDefFiles(const std::vector<std::string> & defFileNames, const boost::filesystem::path & sourceFolder, bool deleteOriginals);
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ static void saveTestMap(CMemoryBuffer & serializeBuffer, const std::string & fil
|
||||
{
|
||||
auto path = VCMIDirs::get().userDataPath() / filename;
|
||||
boost::filesystem::remove(path);
|
||||
boost::filesystem::ofstream tmp(path, boost::filesystem::ofstream::binary);
|
||||
std::ofstream tmp(path.c_str(), std::ofstream::binary);
|
||||
|
||||
tmp.write((const char *)serializeBuffer.getBuffer().data(), serializeBuffer.getSize());
|
||||
tmp.flush();
|
||||
|
Loading…
Reference in New Issue
Block a user