improve:墨迹保存

This commit is contained in:
CJK_mkp
2025-06-09 07:40:00 +08:00
parent cc38e8f148
commit 11369aedf8
7 changed files with 1586 additions and 1583 deletions
+5 -13
View File
@@ -102,21 +102,13 @@ namespace Ink_Canvas {
}
catch (Exception ex) when
(ex is IOException ||
ex is UnauthorizedAccessException) // 明确捕获与目录创建相关的异常
ex is UnauthorizedAccessException)
{
// 如果创建失败则尝试使用文档目录
basePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
// 如果创建失败则使用软件根目录作为最终备选
basePath = AppDomain.CurrentDomain.BaseDirectory;
fullPath = Path.Combine(basePath, "Auto Saved - Screenshots", dateFolder);
try {
Directory.CreateDirectory(fullPath);
}
catch (Exception) {
// 如果文档目录也不可用,则使用软件根目录
basePath = AppDomain.CurrentDomain.BaseDirectory;
fullPath = Path.Combine(basePath, "Auto Saved - Screenshots", dateFolder);
Directory.CreateDirectory(fullPath);
}
Directory.CreateDirectory(fullPath);
}
return Path.Combine(fullPath, $"{fileName}.png");