From a2f1611a5454957b3c78eda60cebe82b046b9d5d Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Mon, 29 Apr 2024 01:08:53 -0400 Subject: [PATCH] Now copies project icon to trenchbroom game config directoy --- Editor/src/Commands/Commands/Commands.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Editor/src/Commands/Commands/Commands.cpp b/Editor/src/Commands/Commands/Commands.cpp index 635702a3..14609dd8 100644 --- a/Editor/src/Commands/Commands/Commands.cpp +++ b/Editor/src/Commands/Commands/Commands.cpp @@ -37,8 +37,9 @@ namespace NuakeEditor bool CreateTrenchbroomGameConfig::Execute() { const std::string& cleanProjectName = String::Sanitize(mProject->Name); - const std::string& gameConfigPath = mProject->TrenchbroomPath + "/../games/" + cleanProjectName + "/GameConfig.cfg"; - FileSystem::BeginWriteFile(gameConfigPath, true); + const std::string& gameConfigFolderPath = mProject->TrenchbroomPath + "/../games/" + cleanProjectName + "/"; + const std::string& gameConfigFilePath = gameConfigFolderPath + "GameConfig.cfg"; + FileSystem::BeginWriteFile(gameConfigFilePath, true); std::string templateFile = R"( { @@ -129,6 +130,12 @@ namespace NuakeEditor )"; FileSystem::WriteLine(templateFile); FileSystem::EndWriteFile(); + + // Copy Icon.png + if (FileSystem::FileExists("icon.png")) + { + std::filesystem::copy_file(FileSystem::RelativeToAbsolute("icon.png"), gameConfigFolderPath + "Icon.png"); + } return true; } } \ No newline at end of file