diff --git a/es-app/src/CollectionSystemsManager.cpp b/es-app/src/CollectionSystemsManager.cpp index 300cd600c..4ac172ba0 100644 --- a/es-app/src/CollectionSystemsManager.cpp +++ b/es-app/src/CollectionSystemsManager.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // -// ES-DE +// ES-DE Frontend // CollectionSystemsManager.cpp // // Manages collections of the following two types: @@ -160,6 +160,8 @@ void CollectionSystemsManager::saveCustomCollection(SystemData* sys) configFileIn.open(getCustomCollectionConfigPath(name)); #endif for (std::string gameEntry; getline(configFileIn, gameEntry);) { + // Remove Windows carriage return characters. + gameEntry = Utils::String::replace(gameEntry, "\r", ""); std::string gamePath {Utils::String::replace(gameEntry, "%ROMPATH%", rompath)}; gamePath = Utils::String::replace(gamePath, "//", "/"); // Only add the entry if it doesn't exist, i.e. only add missing files. @@ -1064,6 +1066,8 @@ void CollectionSystemsManager::reactivateCustomCollectionEntry(FileData* game) std::ifstream input {path}; #endif for (std::string gameKey; getline(input, gameKey);) { + // Remove Windows carriage return characters. + gameKey = Utils::String::replace(gameKey, "\r", ""); if (gameKey == gamePath) { setEditMode(it->first, false); toggleGameInCollection(game); @@ -1331,7 +1335,8 @@ void CollectionSystemsManager::populateCustomCollection(CollectionSystemData* sy // it's possible to use either absolute ROM paths in the collection files or using // the path variable. The absolute ROM paths are only used for backward compatibility // with old custom collections. All custom collections saved by ES-DE will use the - // %ROMPATH% variable instead. + // %ROMPATH% variable instead. Also remove Windows carriage return characters. + gameKey = Utils::String::replace(gameKey, "\r", ""); gameKey = Utils::String::replace(gameKey, "%ROMPATH%", rompath); gameKey = Utils::String::replace(gameKey, "//", "/"); diff --git a/es-app/src/CollectionSystemsManager.h b/es-app/src/CollectionSystemsManager.h index 35162271e..a1b07b02b 100644 --- a/es-app/src/CollectionSystemsManager.h +++ b/es-app/src/CollectionSystemsManager.h @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // -// ES-DE +// ES-DE Frontend // CollectionSystemsManager.h // // Manages collections of the following two types: diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index bd24fdcdb..aba50a3fc 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // -// ES-DE +// ES-DE Frontend // FileData.cpp // // Provides game file data structures and functions to access and sort this information. @@ -1107,6 +1107,8 @@ void FileData::launchGame() injectFileStream.open(romRaw); for (std::string line; getline(injectFileStream, line);) { + // Remove Windows carriage return characters. + line = Utils::String::replace(line, "\r", ""); appString += line; if (appString.size() > 4096) break; @@ -1592,6 +1594,8 @@ void FileData::launchGame() std::ifstream injectFileStream; injectFileStream.open(injectFile); for (std::string line; getline(injectFileStream, line);) { + // Remove Windows carriage return characters. + line = Utils::String::replace(line, "\r", ""); arguments += line; if (arguments.size() > 4096) break; diff --git a/es-app/src/FileData.h b/es-app/src/FileData.h index a12e5613d..23d654a64 100644 --- a/es-app/src/FileData.h +++ b/es-app/src/FileData.h @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT // -// ES-DE +// ES-DE Frontend // FileData.h // // Provides game file data structures and functions to access and sort this information.