if else shortcut

This commit is contained in:
ohyzha
2024-08-13 12:04:53 +03:00
parent dba13b754d
commit 55ebb9f630

View File

@@ -129,15 +129,8 @@ namespace OpenVulkano::Scene
uint32_t packedFlag = packIntoSingleFile; uint32_t packedFlag = packIntoSingleFile;
if (packIntoSingleFile) if (packIntoSingleFile)
{ {
bool isPng = std::filesystem::path(fileName).extension() == ".png"; std::filesystem::path fPath(fileName);
if (!isPng) fileName = (fPath.parent_path() / fPath.stem()).string() + "_packed.png";
{
fileName += "_packed.png";
}
else
{
fileName.insert(fileName.size() - 4, "_packed");
}
SavePng(fileName); SavePng(fileName);
} }
std::fstream fs(fileName.c_str(), std::ios_base::out | std::ios_base::binary | (packedFlag ? std::ios_base::app : std::ios_base::trunc)); std::fstream fs(fileName.c_str(), std::ios_base::out | std::ios_base::binary | (packedFlag ? std::ios_base::app : std::ios_base::trunc));