From 13c1c34c82cb1b57d0316bc21c5e59a5fa1b59b4 Mon Sep 17 00:00:00 2001 From: connlost <4348524953.h@gmail.com> Date: Fri, 11 Oct 2024 09:20:49 +0800 Subject: [PATCH] moved migration code to save, and added notice --- src/common/config.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index 4fe28fadd..f5f1416a9 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -525,7 +525,7 @@ void load(const std::filesystem::path& path) { } if (data.contains("GUI")) { - toml::value& gui = data.at("GUI"); + const toml::value& gui = data.at("GUI"); m_icon_size = toml::find_or(gui, "iconSize", 0); m_icon_size_grid = toml::find_or(gui, "iconSizeGrid", 0); @@ -538,10 +538,6 @@ void load(const std::filesystem::path& path) { auto old_game_install_dir = toml::find_fs_path_or(gui, "installDir", {}); if (!old_game_install_dir.empty()) { addGameInstallDir(old_game_install_dir); - gui.as_table().erase("installDir"); - std::ofstream file(path, std::ios::out); - file << data; - file.close(); } const auto install_dir_array = @@ -647,6 +643,9 @@ void save(const std::filesystem::path& path) { data["Settings"]["consoleLanguage"] = m_language; + // TODO Migration code, after a major release this should be removed. + data.at("GUI").as_table().erase("installDir"); + std::ofstream file(path, std::ios::out); file << data; file.close();