From 26472bccbcb91d3d01c12a4c1a789ccef1354420 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 16 Mar 2025 17:35:19 +0100 Subject: [PATCH] (Windows) Made the hack to remove double quotation marks on game launch slightly less dangerous --- es-app/src/FileData.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 8e9574c5e..0cd8b5e25 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -1944,7 +1944,10 @@ void FileData::launchGame() #if defined(_WIN64) // Hack to remove double quotation marks as these can occur under some special circumstances. - command = Utils::String::replace(command, "\"\"", "\""); + const int quotationCount {static_cast( + std::count_if(command.cbegin(), command.cend(), [](char c) { return c == '\"'; }))}; + if (quotationCount % 2 != 0) + command = Utils::String::replace(command, "\"\"", "\""); command = Utils::String::replace( command, "%ESPATH%", Utils::String::replace(Utils::FileSystem::getExePath(), "/", "\\"));