mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
fix Boost deprecation warnings
warnings introduced in v1.81 # Conflicts: # mapeditor/resourceExtractor/ResourceConverter.cpp
This commit is contained in:
committed by
Ivan Savenko
parent
efbed6000b
commit
2f14914120
@@ -33,36 +33,32 @@ void ResourceConverter::convertExtractedResourceFiles(ConversionOptions conversi
|
||||
|
||||
void ResourceConverter::doConvertPcxToPng(bool deleteOriginals)
|
||||
{
|
||||
std::string filename;
|
||||
|
||||
bfs::path imagesPath = VCMIDirs::get().userExtractedPath() / "IMAGES";
|
||||
bfs::directory_iterator end_iter;
|
||||
|
||||
for(bfs::directory_iterator dir_itr(imagesPath); dir_itr != end_iter; ++dir_itr)
|
||||
{
|
||||
const auto filename = dir_itr->path().filename();
|
||||
try
|
||||
{
|
||||
if (!bfs::is_regular_file(dir_itr->status()))
|
||||
return;
|
||||
|
||||
std::string filePath = dir_itr->path().string();
|
||||
std::string fileStem = dir_itr->path().stem().string();
|
||||
filename = dir_itr->path().filename().string();
|
||||
std::string filenameLowerCase = boost::locale::to_lower(filename);
|
||||
std::string filenameLowerCase = boost::algorithm::to_lower_copy(filename.string());
|
||||
|
||||
if(bfs::extension(filenameLowerCase) == ".pcx")
|
||||
if(boost::algorithm::to_lower_copy(filename.extension().string()) == ".pcx")
|
||||
{
|
||||
auto img = BitmapHandler::loadBitmap(filenameLowerCase);
|
||||
bfs::path pngFilePath = imagesPath / (fileStem + ".png");
|
||||
bfs::path pngFilePath = imagesPath / (dir_itr->path().stem().string() + ".png");
|
||||
img.save(pathToQString(pngFilePath), "PNG");
|
||||
|
||||
if(deleteOriginals)
|
||||
bfs::remove(filePath);
|
||||
bfs::remove(dir_itr->path());
|
||||
}
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
logGlobal->info(filename + " " + ex.what() + "\n");
|
||||
logGlobal->info(filename.string() + " " + ex.what() + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user