Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
GUI: Do not replace relative paths with absolute paths in suppressions.
  • Loading branch information
danmar committed Jun 7, 2023
commit 8e7713c36f9c0a4e2af6f7959a62a3680e093a9c
30 changes: 2 additions & 28 deletions gui/projectfiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down