From f19118432de45533ed4bd6c76125136b153dae16 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Thu, 24 Jul 2025 00:20:00 +0800 Subject: [PATCH] =?UTF-8?q?improve:=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow.xaml.cs | 37 ++++++++++++++++++ ...vasForClass.csproj.AssemblyReference.cache | Bin 35237 -> 35374 bytes 2 files changed, 37 insertions(+) diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index eae06189..23b5565d 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -319,6 +319,43 @@ namespace Ink_Canvas { loadPenCanvas(); //加载设置 LoadSettings(true); + // 检查保存路径是否可用,不可用则修正 + try + { + string savePath = Settings.Automation.AutoSavedStrokesLocation; + bool needFix = false; + if (string.IsNullOrWhiteSpace(savePath) || !System.IO.Directory.Exists(savePath)) + { + needFix = true; + } + else + { + // 检查是否可写 + try + { + string testFile = System.IO.Path.Combine(savePath, "test.tmp"); + System.IO.File.WriteAllText(testFile, "test"); + System.IO.File.Delete(testFile); + } + catch + { + needFix = true; + } + } + if (needFix) + { + string newPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "saves"); + Settings.Automation.AutoSavedStrokesLocation = newPath; + if (!System.IO.Directory.Exists(newPath)) + System.IO.Directory.CreateDirectory(newPath); + SaveSettingsToFile(); + LogHelper.WriteLogToFile($"自动修正保存路径为: {newPath}"); + } + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"检测或修正保存路径时出错: {ex.Message}", LogHelper.LogType.Error); + } // 加载自定义背景颜色 LoadCustomBackgroundColor(); diff --git a/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache b/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache index 007dd88682c1e146a5e6a6e4853914122d4656c7..4af914e22079d93b58f0e03491291464a0dba41e 100644 GIT binary patch delta 70 zcmZ2FnQ7e=CJr`6Jq88_#>B~j@}V1JJvt{RD27kAm*kqv$IYhXte29L!^j9!!0^EF X#&?CQ93Zt^WhQzCdd3FEhL#KfgtieT delta 23 ecmZ2Cg=y(zCJr`6T?PgQ#>B~j@}V1JJvsqL(gqX&