Skip to content

Commit a698f58

Browse files
committed
GUI: If build dir does not exist, ask user if it should be created
1 parent 1dfa92c commit a698f58

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

gui/mainwindow.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,22 @@ void MainWindow::checkProject(Project *project)
13331333
else
13341334
mCurrentDirectory = rootpath;
13351335

1336+
if (!project->getProjectFile()->getBuildDir().isEmpty()) {
1337+
QString buildDir = project->getProjectFile()->getBuildDir();
1338+
if (!QDir::isAbsolutePath(buildDir))
1339+
buildDir = mCurrentDirectory + '/' + buildDir;
1340+
if (!QDir(buildDir).exists()) {
1341+
QMessageBox msg(QMessageBox::Critical,
1342+
tr("Cppcheck"),
1343+
tr("Build dir '%1' does not exist, create it?").arg(buildDir),
1344+
QMessageBox::Yes | QMessageBox::No,
1345+
this);
1346+
if (msg.exec() == QMessageBox::Yes) {
1347+
QDir().mkdir(buildDir);
1348+
}
1349+
}
1350+
}
1351+
13361352
if (!project->getProjectFile()->getImportProject().isEmpty()) {
13371353
ImportProject p;
13381354
QString prjfile = inf.canonicalPath() + '/' + project->getProjectFile()->getImportProject();

0 commit comments

Comments
 (0)