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.
This commit is contained in:
parent
fc6558c22b
commit
b74618d989
|
@ -1590,13 +1590,21 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check
|
||||||
if (!QDir::isAbsolutePath(buildDir))
|
if (!QDir::isAbsolutePath(buildDir))
|
||||||
buildDir = inf.canonicalPath() + '/' + buildDir;
|
buildDir = inf.canonicalPath() + '/' + buildDir;
|
||||||
if (!QDir(buildDir).exists()) {
|
if (!QDir(buildDir).exists()) {
|
||||||
QMessageBox msg(QMessageBox::Critical,
|
QMessageBox msg(QMessageBox::Question,
|
||||||
tr("Cppcheck"),
|
tr("Cppcheck"),
|
||||||
tr("Build dir '%1' does not exist, create it?").arg(buildDir),
|
tr("Build dir '%1' does not exist, create it?").arg(buildDir),
|
||||||
QMessageBox::Yes | QMessageBox::No,
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
this);
|
this);
|
||||||
if (msg.exec() == QMessageBox::Yes) {
|
if (msg.exec() == QMessageBox::Yes) {
|
||||||
QDir().mkpath(buildDir);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue