修改Camera.cs文件,更新保存路径处理逻辑
This commit is contained in:
@@ -1715,24 +1715,25 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 设置保存对话框的初始目录为ProjectPath属性的值
|
// 设置保存对话框的初始目录为ProjectPath属性的值
|
||||||
if (!string.IsNullOrEmpty(ProjectPath))
|
String SavePath = String.IsNullOrWhiteSpace(ProjectPath) ? Application.StartupPath : ProjectPath;
|
||||||
|
if (!string.IsNullOrEmpty(SavePath))
|
||||||
{
|
{
|
||||||
// 确保目录存在
|
// 确保目录存在
|
||||||
if (Directory.Exists(ProjectPath))
|
if (Directory.Exists(SavePath))
|
||||||
{
|
{
|
||||||
saveFileDialog.InitialDirectory = ProjectPath;
|
saveFileDialog.InitialDirectory = SavePath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 尝试创建目录
|
// 尝试创建目录
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(ProjectPath);
|
Directory.CreateDirectory(SavePath);
|
||||||
saveFileDialog.InitialDirectory = ProjectPath;
|
saveFileDialog.InitialDirectory = SavePath;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"创建项目路径目录失败: {ex.Message}");
|
Console.WriteLine($"创建保存路径目录失败: {ex.Message}");
|
||||||
// 如果创建目录失败,则不设置初始目录,使用默认行为
|
// 如果创建目录失败,则不设置初始目录,使用默认行为
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user