diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/Camera.cs b/Windows/CS/Framework4.0/Toprie/Toprie/Camera.cs index 3cafd86..b4dfd0d 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/Camera.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/Camera.cs @@ -1715,24 +1715,25 @@ namespace JoyD.Windows.CS.Toprie }; // 设置保存对话框的初始目录为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 { // 尝试创建目录 try { - Directory.CreateDirectory(ProjectPath); - saveFileDialog.InitialDirectory = ProjectPath; + Directory.CreateDirectory(SavePath); + saveFileDialog.InitialDirectory = SavePath; } catch (Exception ex) { - Console.WriteLine($"创建项目路径目录失败: {ex.Message}"); + Console.WriteLine($"创建保存路径目录失败: {ex.Message}"); // 如果创建目录失败,则不设置初始目录,使用默认行为 } }