(Windows) Fixed an issue where the emulator binary path would sometimes not get escaped correctly in es_log.txt on game launch.

Also fixed some other path escape inconsistencies.
This commit is contained in:
Leon Styhre 2022-07-01 16:42:21 +02:00
parent 81268fb11c
commit f4e3875952

View file

@ -1027,9 +1027,11 @@ void FileData::launchGame()
}
#if defined(_WIN64)
else {
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary "
<< Utils::String::replace(
Utils::String::replace(binaryPath, "%ESPATH%", esPath), "/", "\\");
std::string binaryLogPath {Utils::String::replace(
Utils::String::replace(binaryPath, "%ESPATH%", esPath), "/", "\\")};
if (binaryLogPath.front() != '\"' && binaryLogPath.back() != '\"')
binaryLogPath = "\"" + binaryLogPath + "\"";
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary " << binaryLogPath;
#else
else if (!isShortcut) {
LOG(LogDebug) << "FileData::launchGame(): Found emulator binary \""
@ -1714,9 +1716,10 @@ const std::string FileData::findEmulatorPath(std::string& command)
if (pathStatus == ERROR_SUCCESS) {
if (Utils::FileSystem::isRegularFile(registryPath) ||
Utils::FileSystem::isSymlink(registryPath)) {
command.replace(startPos, endPos - startPos + 1, registryPath);
exePath = Utils::FileSystem::getEscapedPath(registryPath);
command.replace(startPos, endPos - startPos + 1, exePath);
RegCloseKey(registryKey);
return registryPath;
return exePath;
}
}
RegCloseKey(registryKey);
@ -1777,9 +1780,10 @@ const std::string FileData::findEmulatorPath(std::string& command)
// so check for that as well.
if (pathStatus == ERROR_SUCCESS) {
if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) {
command.replace(startPos, endPos - startPos + 1, path);
exePath = Utils::FileSystem::getEscapedPath(path);
command.replace(startPos, endPos - startPos + 1, exePath);
RegCloseKey(registryKey);
return path;
return exePath;
}
}
RegCloseKey(registryKey);
@ -1807,6 +1811,7 @@ const std::string FileData::findEmulatorPath(std::string& command)
}
if (exePath != "") {
exePath += "\\" + path;
exePath = Utils::FileSystem::getEscapedPath(exePath);
command.replace(startPos, endPos - startPos + 1, exePath);
return exePath;
}
@ -1842,9 +1847,9 @@ const std::string FileData::findEmulatorPath(std::string& command)
}
if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) {
path = Utils::FileSystem::getEscapedPath(path);
command.replace(startPos, endPos - startPos + 1, path);
return path;
exePath = Utils::FileSystem::getEscapedPath(path);
command.replace(startPos, endPos - startPos + 1, exePath);
return exePath;
}
}