- fix: header file wrongly opened when there are compiler errors

This commit is contained in:
royqh1979 2021-09-04 21:33:10 +08:00
parent 73d578b7e4
commit 721f01f6cb
2 changed files with 6 additions and 1 deletions

View File

@ -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()));
}

View File

@ -1497,9 +1497,12 @@ void MainWindow::onCompileFinished()
for (int i=0;i<ui->tableIssues->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;i<ui->tableIssues->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);