improve:墨迹保存

This commit is contained in:
CJK_mkp
2025-06-09 00:16:15 +08:00
parent b0c6bbb8f7
commit cc38e8f148
+10 -1
View File
@@ -104,11 +104,20 @@ namespace Ink_Canvas {
(ex is IOException ||
ex is UnauthorizedAccessException) // 明确捕获与目录创建相关的异常
{
// 如果创建失败则使用文档目录
// 如果创建失败则尝试使用文档目录
basePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
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);
}
}
return Path.Combine(fullPath, $"{fileName}.png");
}