修复bug:创建工程时会删除工程路径下的内容,修复后不会删除内容;

This commit is contained in:
tangchao0503
2022-06-16 15:45:54 +08:00
parent f36c5eaa39
commit 24cce6e49a
2 changed files with 10 additions and 8 deletions

View File

@ -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);

View File

@ -253,7 +253,7 @@ namespace mainProgram
return 3;
}
DelectDir(mProjectPath);//删除工程路径下的所有内容
//DelectDir(mProjectPath);//删除工程路径下的所有内容 → 应该删除此行代码,删除数据太危险
CreateProjectStructure();