GUI: Do not replace relative paths with absolute paths in suppressions. (#5127)

This commit is contained in:
Daniel Marjamäki 2023-06-07 20:42:18 +02:00 committed by GitHub
parent 39f958bcfb
commit ae83d53813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 28 deletions

View File

@ -753,34 +753,8 @@ void ProjectFileDialog::setLibraries(const QStringList &libraries)
void ProjectFileDialog::addSingleSuppression(const Suppressions::Suppression &suppression)
{
QString suppression_name;
static const char sep = QDir::separator().toLatin1();
bool found_relative = false;
// Replace relative file path in the suppression with the absolute one
if ((suppression.fileName.find('*') == std::string::npos) &&
(suppression.fileName.find(sep) == std::string::npos)) {
QFileInfo inf(mProjectFile->getFilename());
QString rootpath = inf.absolutePath();
if (QFile::exists(QString{"%1%2%3"}.arg(rootpath,
QDir::separator(),
QString::fromStdString(suppression.fileName)))) {
Suppressions::Suppression sup = suppression;
sup.fileName = rootpath.toLatin1().constData();
sup.fileName += sep;
sup.fileName += suppression.fileName;
mSuppressions += sup;
suppression_name = QString::fromStdString(sup.getText());
found_relative = true;
}
}
if (!found_relative) {
mSuppressions += suppression;
suppression_name = QString::fromStdString(suppression.getText());
}
mUI->mListSuppressions->addItem(suppression_name);
mSuppressions += suppression;
mUI->mListSuppressions->addItem(QString::fromStdString(suppression.getText()));
}
void ProjectFileDialog::setSuppressions(const QList<Suppressions::Suppression> &suppressions)