From 55ebb9f630cecbfde333b40b02195e78deaf441a Mon Sep 17 00:00:00 2001 From: ohyzha Date: Tue, 13 Aug 2024 12:04:53 +0300 Subject: [PATCH] if else shortcut --- openVulkanoCpp/Scene/FontAtlasGenerator.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/openVulkanoCpp/Scene/FontAtlasGenerator.cpp b/openVulkanoCpp/Scene/FontAtlasGenerator.cpp index 0d3abef..1d0cf5d 100644 --- a/openVulkanoCpp/Scene/FontAtlasGenerator.cpp +++ b/openVulkanoCpp/Scene/FontAtlasGenerator.cpp @@ -129,15 +129,8 @@ namespace OpenVulkano::Scene uint32_t packedFlag = packIntoSingleFile; if (packIntoSingleFile) { - bool isPng = std::filesystem::path(fileName).extension() == ".png"; - if (!isPng) - { - fileName += "_packed.png"; - } - else - { - fileName.insert(fileName.size() - 4, "_packed"); - } + std::filesystem::path fPath(fileName); + fileName = (fPath.parent_path() / fPath.stem()).string() + "_packed.png"; 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));