feat: implement lax filename match in BlockedModsDialog
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
d61323aa6d
commit
e08d97825d
@ -236,14 +236,24 @@ void BlockedModsDialog::checkMatchHash(QString hash, QString path)
|
|||||||
/// @return boolean: did the path match the name of a blocked mod?
|
/// @return boolean: did the path match the name of a blocked mod?
|
||||||
bool BlockedModsDialog::checkValidPath(QString path)
|
bool BlockedModsDialog::checkValidPath(QString path)
|
||||||
{
|
{
|
||||||
QFileInfo file = QFileInfo(path);
|
const QFileInfo file = QFileInfo(path);
|
||||||
QString filename = file.fileName();
|
const QString filename = file.fileName();
|
||||||
|
QString laxFilename(filename);
|
||||||
|
laxFilename.replace('+', ' ');
|
||||||
|
|
||||||
|
auto compare = [](QString fsfilename, QString metadataFilename) {
|
||||||
|
return metadataFilename.compare(fsfilename, Qt::CaseInsensitive) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
for (auto& mod : m_mods) {
|
for (auto& mod : m_mods) {
|
||||||
if (mod.name.compare(filename, Qt::CaseInsensitive) == 0) {
|
if (compare(filename, mod.name)) {
|
||||||
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;
|
qDebug() << "[Blocked Mods Dialog] Name match found:" << mod.name << "| From path:" << path;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (compare(laxFilename, mod.name)) {
|
||||||
|
qDebug() << "[Blocked Mods Dialog] Lax name match found:" << mod.name << "| From path:" << path;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user