diff --git a/mainProgram/NewProjectWindow.cs b/mainProgram/NewProjectWindow.cs index 728a705..ad1dfb9 100644 --- a/mainProgram/NewProjectWindow.cs +++ b/mainProgram/NewProjectWindow.cs @@ -34,6 +34,15 @@ namespace mainProgram string projectPath = ProjectPathTextBox.Text; string calFilePath = CalFilePathTextBox.Text; + //当创建工程时,工程文件夹必须为空 + DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(projectPath)); + FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); + if (fileinfo.Length != 0) + { + MessageBox.Show(this, "工程文件夹中有内容", "提示"); + return; + } + if (dataPath != null && dataPath.Length == 0) { MessageBox.Show(this, "数据文件夹路径不能为空", "提示"); @@ -50,13 +59,6 @@ namespace mainProgram return; } - //做判断: - DialogResult re = MessageBox.Show("删除工程路径下所有内容?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); - if (re == DialogResult.Cancel) - { - return; - } - //创建工程 ProjectManager projectManager = new ProjectManager(projectPath); int value = projectManager.CreateProject(calFilePath, dataPath); diff --git a/mainProgram/ProjectManager.cs b/mainProgram/ProjectManager.cs index 7a4519c..b0203e6 100644 --- a/mainProgram/ProjectManager.cs +++ b/mainProgram/ProjectManager.cs @@ -253,7 +253,7 @@ namespace mainProgram return 3; } - DelectDir(mProjectPath);//删除工程路径下的所有内容 + //DelectDir(mProjectPath);//删除工程路径下的所有内容 → 应该删除此行代码,删除数据太危险 CreateProjectStructure();