瀏覽代碼

ENH: add error checking for empty build dir

Bill Hoffman 24 年之前
父節點
當前提交
11b68dea51
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      Source/MFCDialog/CMakeSetupDialog.cpp

+ 16 - 0
Source/MFCDialog/CMakeSetupDialog.cpp

@@ -315,6 +315,22 @@ void CMakeSetupDialog::LoadFromRegistry()
 
 void CMakeSetupDialog::OnBuildProjects() 
 {
+  if(!cmSystemTools::FileExists(m_WhereBuild))
+    {
+    std::string message =
+      "Build directory does not exist, should I create it?\n\n"
+      "Directory: ";
+    message += (const char*)m_WhereBuild;
+    if(MessageBox(message.c_str(), "Create Directory", MB_OKCANCEL) == IDOK)
+      {
+      cmSystemTools::MakeDirectory(m_WhereBuild);
+      }
+    else
+      {
+      MessageBox("Build Project aborted, nothing done.");
+      return;
+      }
+    }
   ::SetCursor(LoadCursor(NULL, IDC_WAIT));
   // get all the info from the screen
   this->UpdateData();