fix(settings-refactor): use pluginConfigs root for backup path
This commit is contained in:
+11
-11
@@ -108,16 +108,17 @@ 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
|
||||||
{
|
{
|
||||||
@@ -128,9 +129,8 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Backup failure is non-fatal — the wipe still runs, the user
|
Log.Warning(ex, "HellionChat: pre-v10 config backup failed");
|
||||||
// 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
|
||||||
|
|||||||
Reference in New Issue
Block a user