From 721f01f6cb02d586ef175e84e4182fb208e51515 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Sat, 4 Sep 2021 21:33:10 +0800 Subject: [PATCH] - fix: header file wrongly opened when there are compiler errors --- RedPandaIDE/compiler/filecompiler.cpp | 2 +- RedPandaIDE/mainwindow.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RedPandaIDE/compiler/filecompiler.cpp b/RedPandaIDE/compiler/filecompiler.cpp index 63972d6e..ca9b723b 100644 --- a/RedPandaIDE/compiler/filecompiler.cpp +++ b/RedPandaIDE/compiler/filecompiler.cpp @@ -84,7 +84,7 @@ bool FileCompiler::prepareForRebuild() QString exeName = getCompiledExecutableName(mFilename); QFile file(exeName); - if (!file.remove()) { + if (file.exists() && !file.remove()) { QFileInfo info(exeName); throw CompileError(tr("Can't delete the old executable file \"%1\".\n").arg(info.absoluteFilePath())); } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 2c2e0d9c..65f53582 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1497,9 +1497,12 @@ void MainWindow::onCompileFinished() for (int i=0;itableIssues->count();i++) { PCompileIssue issue = ui->tableIssues->issue(i); if (issue->type == CompileIssueType::Error) { + if (e && e->filename() != issue->filename) + continue; ui->tableIssues->selectRow(i); QModelIndex index =ui->tableIssues->model()->index(i,0); emit ui->tableIssues->doubleClicked(index); + break; } } @@ -1507,6 +1510,8 @@ void MainWindow::onCompileFinished() for (int i=0;itableIssues->count();i++) { PCompileIssue issue = ui->tableIssues->issue(i); if (issue->type == CompileIssueType::Warning) { + if (e && e->filename() != issue->filename) + continue; ui->tableIssues->selectRow(i); QModelIndex index =ui->tableIssues->model()->index(i,0); emit ui->tableIssues->doubleClicked(index);