From b74618d989fbea18090969464b20babcc62c1a07 Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Wed, 9 Jun 2021 12:21:23 +0300 Subject: [PATCH] gui: Handle errors in creating build directory (#3295) If user doesn't create a build directory, it is not possible to run the addons, because addons are trying to check dump files in non-existent build directory. --- gui/mainwindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 1e00d132d..f43a5e97b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1590,13 +1590,21 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check if (!QDir::isAbsolutePath(buildDir)) buildDir = inf.canonicalPath() + '/' + buildDir; if (!QDir(buildDir).exists()) { - QMessageBox msg(QMessageBox::Critical, + QMessageBox msg(QMessageBox::Question, tr("Cppcheck"), tr("Build dir '%1' does not exist, create it?").arg(buildDir), QMessageBox::Yes | QMessageBox::No, this); if (msg.exec() == QMessageBox::Yes) { QDir().mkpath(buildDir); + } else if (!projectFile->getAddons().isEmpty()) { + QMessageBox m(QMessageBox::Critical, + tr("Cppcheck"), + tr("To check the project using addons, you need a build directory."), + QMessageBox::Ok, + this); + m.exec(); + return; } } }