From ae83d538135d2462b59e67acb781ec673fffc224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 7 Jun 2023 20:42:18 +0200 Subject: [PATCH] GUI: Do not replace relative paths with absolute paths in suppressions. (#5127) --- gui/projectfiledialog.cpp | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index b3e8624a3..29dd2b419 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -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)