From 63fe36920a482b44aa1568588a77966ee1ec78f7 Mon Sep 17 00:00:00 2001 From: goat Date: Mon, 26 Dec 2022 15:05:54 +0100 Subject: [PATCH] fix: "pick and restart" option in branch switcher not saving in time --- Dalamud/Configuration/Internal/DalamudConfiguration.cs | 10 +++++++++- .../Interface/Internal/Windows/BranchSwitcherWindow.cs | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Dalamud/Configuration/Internal/DalamudConfiguration.cs b/Dalamud/Configuration/Internal/DalamudConfiguration.cs index f623f8007..cce922697 100644 --- a/Dalamud/Configuration/Internal/DalamudConfiguration.cs +++ b/Dalamud/Configuration/Internal/DalamudConfiguration.cs @@ -370,13 +370,21 @@ internal sealed class DalamudConfiguration : IServiceType } /// - /// Save the configuration at the path it was loaded from. + /// Save the configuration at the path it was loaded from, at the next frame. /// public void QueueSave() { this.isSaveQueued = true; } + /// + /// Immediately save the configuration. + /// + public void ForceSave() + { + this.Save(); + } + /// /// Save the file, if needed. Only needs to be done once a frame. /// diff --git a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs index e934f9df6..dd2d911ff 100644 --- a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs +++ b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs @@ -103,6 +103,9 @@ public class BranchSwitcherWindow : Window { Pick(); + // If we exit immediately, we need to write out the new config now + Service.Get().ForceSave(); + var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var xlPath = Path.Combine(appData, "XIVLauncher", "XIVLauncher.exe");