Fix toc subfixes not being detected in subfolders

This commit is contained in:
woblight
2023-04-30 00:28:46 +02:00
parent b97f863ea8
commit ebb7a524e4
3 changed files with 26 additions and 9 deletions
+12 -7
View File
@@ -66,6 +66,17 @@ QStringList Control::addonsPaths() const
return m_addonsPaths;
}
void Control::removeTocSuffixes(QString &string)
{
string.replace("-Classic.toc",".toc", Qt::CaseInsensitive);
string.replace("-BCC.toc",".toc", Qt::CaseInsensitive);
string.replace("_Vanilla.toc",".toc", Qt::CaseInsensitive);
string.replace("_TBC.toc",".toc", Qt::CaseInsensitive);
string.replace("_Mainline.toc",".toc", Qt::CaseInsensitive);
string.replace("_Wrath.toc",".toc", Qt::CaseInsensitive);
string.replace("-WOTLKC.toc",".toc", Qt::CaseInsensitive);
}
void Control::delegate(QString taskname, auto work, auto callback)
{
Q_ASSERT_X(QThread::currentThread() == thread(), "delegate", "Attempt to delegate from another thread.");
@@ -379,13 +390,7 @@ void Control::clone(QUrl url, int i)
std::transform(tocs.begin(), tocs.end(),
tocs.begin(),
[](auto toc) {
toc.replace("-Classic.toc",".toc", Qt::CaseInsensitive);
toc.replace("-BCC.toc",".toc", Qt::CaseInsensitive);
toc.replace("_Vanilla.toc",".toc", Qt::CaseInsensitive);
toc.replace("_TBC.toc",".toc", Qt::CaseInsensitive);
toc.replace("_Mainline.toc",".toc", Qt::CaseInsensitive);
toc.replace("_Wrath.toc",".toc", Qt::CaseInsensitive);
toc.replace("-WOTLKC.toc",".toc", Qt::CaseInsensitive);
Control::removeTocSuffixes(toc);
return toc;
});
if (!std::all_of(tocs.begin() + 1, tocs.end(),