fix(settings-refactor): use pluginConfigs root for backup path

This commit is contained in:
2026-05-02 16:03:51 +02:00
parent 14e585ef63
commit c33e519bb9
+18 -18
View File
@@ -108,29 +108,29 @@ public sealed class Plugin : IDalamudPlugin
// Drop them on load to guarantee the session-only invariant. // Drop them on load to guarantee the session-only invariant.
Config.Tabs.RemoveAll(t => t.IsTempTab); Config.Tabs.RemoveAll(t => t.IsTempTab);
// Hellion Chat v9 → v10 — Settings UX Polish wipes the configuration so // Hellion Chat v9 → v10 — wipes the configuration so the new 8-tab
// the new 8-tab layout starts from defaults instead of mapping every // layout starts from defaults instead of mapping every previous setting
// previous setting to its new position. The chat database lives in a // to its new position. Backup-Failure ist non-fatal, der Wipe läuft
// separate file and is not touched. A backup of the pre-wipe JSON is // trotzdem; dem User fehlt dann nur das manuelle Restore-Sicherheitsnetz.
// placed next to the live config as a manual restore safety net.
if (Config.Version < 10) if (Config.Version < 10)
{ {
var configDir = Interface.ConfigDirectory.FullName; var pluginConfigsDir = Interface.ConfigDirectory.Parent?.FullName;
var liveConfigPath = Path.Join(configDir, $"{Interface.InternalName}.json"); if (pluginConfigsDir is not null)
var backupPath = Path.Join(configDir, $"{Interface.InternalName}.json.pre-v10-backup"); {
var liveConfigPath = Path.Combine(pluginConfigsDir, $"{Interface.InternalName}.json");
var backupPath = Path.Combine(pluginConfigsDir, $"{Interface.InternalName}.json.pre-v10-backup");
try try
{
if (File.Exists(liveConfigPath))
{ {
File.Copy(liveConfigPath, backupPath, overwrite: true); if (File.Exists(liveConfigPath))
{
File.Copy(liveConfigPath, backupPath, overwrite: true);
}
}
catch (Exception ex)
{
Log.Warning(ex, "HellionChat: pre-v10 config backup failed");
} }
}
catch (Exception ex)
{
// Backup failure is non-fatal — the wipe still runs, the user
// just loses the safety net for manual restore.
Plugin.Log.Warning(ex, "[SettingsRefactor] Could not write pre-v10 config backup");
} }
Config = new Configuration Config = new Configuration