Made re-enabling of custom collection entries work on Windows with UTF-16 support.

This commit is contained in:
Leon Styhre 2021-01-01 10:28:42 +01:00
parent 128056667d
commit 5e7480bfab
4 changed files with 14 additions and 16 deletions

View file

@ -610,6 +610,13 @@ void CollectionSystemsManager::exitEditMode(bool showPopup)
mIsEditingCustom = false;
mEditingCollection = "Favorites";
// Remove all tick marks from the games that are part of the collection.
for (auto it = SystemData::sSystemVector.begin();
it != SystemData::sSystemVector.end(); it++) {
ViewController::get()->getGameListView((*it))->onFileChanged(
ViewController::get()->getGameListView((*it))->getCursor(), false);
}
mEditingCollectionSystemData->system->onMetaDataSavePoint();
}
@ -902,7 +909,11 @@ void CollectionSystemsManager::reactivateCustomCollectionEntry(FileData* game)
it != mCustomCollectionSystemsData.cend(); it++) {
std::string path = getCustomCollectionConfigPath(it->first);
if (Utils::FileSystem::exists(path)) {
#if defined(_WIN64)
std::ifstream input(Utils::String::stringToWideString(path).c_str());
#else
std::ifstream input(path);
#endif
for (std::string gameKey; getline(input, gameKey);) {
if (gameKey == gamePath) {
setEditMode(it->first, false);
@ -1043,7 +1054,7 @@ void CollectionSystemsManager::populateCustomCollection(CollectionSystemData* sy
FileFilterIndex* index = newSys->getIndex();
// Get configuration for this custom collection.
#if _WIN64
#if defined (_WIN64)
std::ifstream input(Utils::String::stringToWideString(path).c_str());
#else
std::ifstream input(path);

View file

@ -14,10 +14,8 @@
#include "guis/GuiMsgBox.h"
#include "guis/GuiSettings.h"
#include "guis/GuiTextEditPopup.h"
#include "views/gamelist/IGameListView.h"
#include "views/ViewController.h"
#include "CollectionSystemsManager.h"
#include "SystemData.h"
GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
Window* window,
@ -34,11 +32,6 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
"' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.makeAcceptInputHandler([this] {
CollectionSystemsManager::get()->exitEditMode();
for (auto it = SystemData::sSystemVector.begin();
it != SystemData::sSystemVector.end(); it++) {
ViewController::get()->getGameListView((*it))->onFileChanged(
ViewController::get()->getGameListView((*it))->getCursor(), false);
}
mWindow->invalidateCachedBackground();
delete this;
});

View file

@ -298,13 +298,6 @@ void GuiGamelistOptions::startEditMode()
void GuiGamelistOptions::exitEditMode()
{
CollectionSystemsManager::get()->exitEditMode();
for (auto it = SystemData::sSystemVector.begin();
it != SystemData::sSystemVector.end(); it++) {
ViewController::get()->getGameListView((*it))->onFileChanged(
ViewController::get()->getGameListView((*it))->getCursor(), false);
}
delete this;
}

View file

@ -75,7 +75,8 @@ void Log::flush()
void Log::close()
{
file.close();
if (file.is_open())
file.close();
}
Log::~Log()