diff --git a/es-app/src/CollectionSystemsManager.cpp b/es-app/src/CollectionSystemsManager.cpp index 838e332f9..3f22b5154 100644 --- a/es-app/src/CollectionSystemsManager.cpp +++ b/es-app/src/CollectionSystemsManager.cpp @@ -155,9 +155,10 @@ void CollectionSystemsManager::saveCustomCollection(SystemData* sys) #if defined(_WIN64) configFileIn.open( - Utils::String::stringToWideString(getCustomCollectionConfigPath(name)).c_str()); + Utils::String::stringToWideString(getCustomCollectionConfigPath(name)).c_str(), + std::ios::binary); #else - configFileIn.open(getCustomCollectionConfigPath(name)); + configFileIn.open(getCustomCollectionConfigPath(name), std::ios::binary); #endif for (std::string gameEntry; getline(configFileIn, gameEntry);) { std::string gamePath {Utils::String::replace(gameEntry, "%ROMPATH%", rompath)}; @@ -187,9 +188,10 @@ void CollectionSystemsManager::saveCustomCollection(SystemData* sys) #if defined(_WIN64) configFileOut.open( - Utils::String::stringToWideString(getCustomCollectionConfigPath(name)).c_str()); + Utils::String::stringToWideString(getCustomCollectionConfigPath(name)).c_str(), + std::ios::binary); #else - configFileOut.open(getCustomCollectionConfigPath(name)); + configFileOut.open(getCustomCollectionConfigPath(name), std::ios::binary); #endif for (auto it = fileGameEntries.cbegin(); it != fileGameEntries.cend(); ++it) @@ -1035,9 +1037,9 @@ void CollectionSystemsManager::reactivateCustomCollectionEntry(FileData* game) std::string path {getCustomCollectionConfigPath(it->first)}; if (Utils::FileSystem::exists(path)) { #if defined(_WIN64) - std::ifstream input(Utils::String::stringToWideString(path).c_str()); + std::ifstream input {Utils::String::stringToWideString(path).c_str(), std::ios::binary}; #else - std::ifstream input(path); + std::ifstream input {path, std::ios::binary}; #endif for (std::string gameKey; getline(input, gameKey);) { if (gameKey == gamePath) { @@ -1283,9 +1285,9 @@ void CollectionSystemsManager::populateCustomCollection(CollectionSystemData* sy // Get configuration for this custom collection. #if defined(_WIN64) - std::ifstream input(Utils::String::stringToWideString(path).c_str()); + std::ifstream input {Utils::String::stringToWideString(path).c_str(), std::ios::binary}; #else - std::ifstream input(path); + std::ifstream input {path, std::ios::binary}; #endif // Get all files map. diff --git a/es-app/src/guis/GuiOrphanedDataCleanup.cpp b/es-app/src/guis/GuiOrphanedDataCleanup.cpp index 831a8a488..0baf86426 100644 --- a/es-app/src/guis/GuiOrphanedDataCleanup.cpp +++ b/es-app/src/guis/GuiOrphanedDataCleanup.cpp @@ -726,9 +726,10 @@ void GuiOrphanedDataCleanup::cleanupCollections() std::ifstream configFileSource; #if defined(_WIN64) - configFileSource.open(Utils::String::stringToWideString(collectionFile).c_str()); + configFileSource.open(Utils::String::stringToWideString(collectionFile).c_str(), + std::ios::binary); #else - configFileSource.open(collectionFile); + configFileSource.open(collectionFile, std::ios::binary); #endif if (!configFileSource.good()) { LOG(LogError) << "Couldn't open custom collection configuration file \"" diff --git a/es-app/src/scrapers/GamesDBJSONScraperResources.cpp b/es-app/src/scrapers/GamesDBJSONScraperResources.cpp index 1026e6ae5..372ea5453 100644 --- a/es-app/src/scrapers/GamesDBJSONScraperResources.cpp +++ b/es-app/src/scrapers/GamesDBJSONScraperResources.cpp @@ -146,7 +146,7 @@ bool TheGamesDBJSONRequestResources::saveResource(HttpReq* req, ensureScrapersResourcesDir(); - std::ofstream fout {file_name}; + std::ofstream fout {file_name, std::ios::binary}; fout << req->getContent(); fout.close(); loadResource(resource, resource_name, file_name); @@ -165,7 +165,7 @@ int TheGamesDBJSONRequestResources::loadResource(std::unordered_map " + tempFile + " 2>/dev/null"); std::ifstream tempFileStream; - tempFileStream.open(tempFile); + tempFileStream.open(tempFile, std::ios::binary); getline(tempFileStream, emulatorPath); tempFileStream.close();