From 55a7a1a048360197795f1608b23e36797d93a33c Mon Sep 17 00:00:00 2001 From: hbeham Date: Thu, 25 Jul 2019 18:02:17 +0200 Subject: [PATCH] - fix: Application failed to save config and didn't exit when the folder %LOCALAPPDATA%\ChanSort doesn't exist --- source/ChanSort/MainForm.cs | 15 +++++++++++---- source/ChanSort/Properties/Config.cs | 3 +++ source/changelog.md | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/source/ChanSort/MainForm.cs b/source/ChanSort/MainForm.cs index 7cb1561..0bacc46 100644 --- a/source/ChanSort/MainForm.cs +++ b/source/ChanSort/MainForm.cs @@ -2516,10 +2516,17 @@ namespace ChanSort.Ui private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { - if (this.PromptSaveAndContinue()) - this.SaveSettings(); - else - e.Cancel = true; + try + { + if (this.PromptSaveAndContinue()) + this.SaveSettings(); + else + e.Cancel = true; + } + catch + { + // ignore - always allow to exit + } } #endregion diff --git a/source/ChanSort/Properties/Config.cs b/source/ChanSort/Properties/Config.cs index 4a3ad10..6c32079 100644 --- a/source/ChanSort/Properties/Config.cs +++ b/source/ChanSort/Properties/Config.cs @@ -57,6 +57,9 @@ namespace ChanSort.Ui.Properties public void Save() { + var folder = Path.GetDirectoryName(ConfigFilePath); + Directory.CreateDirectory(folder); + using (var stream = new FileStream(ConfigFilePath, FileMode.Create)) using (var writer = new StreamWriter(stream, System.Text.Encoding.UTF8)) { diff --git a/source/changelog.md b/source/changelog.md index c1e27ff..dd4b574 100644 --- a/source/changelog.md +++ b/source/changelog.md @@ -1,6 +1,9 @@ ChanSort Change Log =================== +2019-07-25 +- fix: Application failed to save config and didn't exit when the folder %LOCALAPPDATA%\ChanSort doesn't exist + 2019-07-20 - user settings are now persisted across releases in %LOCALAPPDATA%\ChanSort\config.xml - fixed Sony sdb.xml DVB-T channel lists