(Windows) Fixed a game launching issue when passing parameters using a forward slash.

This commit is contained in:
Leon Styhre 2021-07-16 17:14:16 +02:00
parent fd742ab452
commit 4197ad7f6a

View file

@ -1217,9 +1217,7 @@ std::string FileData::findEmulatorPath(std::string& command)
path = Utils::String::replace(path, "%ESPATH%", Utils::FileSystem::getExePath()); path = Utils::String::replace(path, "%ESPATH%", Utils::FileSystem::getExePath());
// Likewise for the %ROMPATH% variable which expands to the configured ROM directory. // Likewise for the %ROMPATH% variable which expands to the configured ROM directory.
path = Utils::String::replace(path, "%ROMPATH%", getROMDirectory()); path = Utils::String::replace(path, "%ROMPATH%", getROMDirectory());
#if defined(_WIN64)
path = Utils::String::replace(path, "/", "\\");
#endif
if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) { if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) {
command.replace(0, endPos + 1, path); command.replace(0, endPos + 1, path);
return path; return path;
@ -1230,9 +1228,6 @@ std::string FileData::findEmulatorPath(std::string& command)
// If %ESPATH% is used, then expand it to the binary directory of ES-DE. // If %ESPATH% is used, then expand it to the binary directory of ES-DE.
command = Utils::String::replace(command, "%ESPATH%", Utils::FileSystem::getExePath()); command = Utils::String::replace(command, "%ESPATH%", Utils::FileSystem::getExePath());
#if defined(_WIN64)
command = Utils::String::replace(command, "/", "\\");
#endif
// If the first character is a quotation mark, then we need to extract up to the // If the first character is a quotation mark, then we need to extract up to the
// next quotation mark, otherwise we'll only extract up to the first space character. // next quotation mark, otherwise we'll only extract up to the first space character.