mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Windows carriage return characters are now filtered out when reading custom collection files and inject files
This commit is contained in:
parent
4cd4a8e6c0
commit
933177dad1
|
@ -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, "//", "/");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// ES-DE
|
||||
// ES-DE Frontend
|
||||
// CollectionSystemsManager.h
|
||||
//
|
||||
// Manages collections of the following two types:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue