Fix toc subfixes not being detected in subfolders
This commit is contained in:
@@ -154,12 +154,22 @@ void Addon::scanSubfolders()
|
|||||||
QString path = root;
|
QString path = root;
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
path = path.chopped(1);
|
||||||
QStringList *sf = static_cast<QStringList *>(payload);
|
QStringList *sf = static_cast<QStringList *>(payload);
|
||||||
QString file = git_tree_entry_name(entry);
|
QString file = git_tree_entry_name(entry);
|
||||||
if (file.toLower() == path.toLower().chopped(1) + ".toc") {
|
|
||||||
*sf << path.chopped(1);
|
if (!sf->contains(path) && !file.compare(path + ".toc", Qt::CaseInsensitive)) {
|
||||||
|
*sf << path;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Control::removeTocSuffixes(file);
|
||||||
|
|
||||||
|
if (!sf->contains(path) && !file.compare(path + ".toc", Qt::CaseInsensitive)) {
|
||||||
|
*sf << path;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (path.split("/").size() > 1)
|
if (path.split("/").size() > 1)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+12
-7
@@ -66,6 +66,17 @@ QStringList Control::addonsPaths() const
|
|||||||
return m_addonsPaths;
|
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)
|
void Control::delegate(QString taskname, auto work, auto callback)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(QThread::currentThread() == thread(), "delegate", "Attempt to delegate from another thread.");
|
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(),
|
std::transform(tocs.begin(), tocs.end(),
|
||||||
tocs.begin(),
|
tocs.begin(),
|
||||||
[](auto toc) {
|
[](auto toc) {
|
||||||
toc.replace("-Classic.toc",".toc", Qt::CaseInsensitive);
|
Control::removeTocSuffixes(toc);
|
||||||
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);
|
|
||||||
return toc;
|
return toc;
|
||||||
});
|
});
|
||||||
if (!std::all_of(tocs.begin() + 1, tocs.end(),
|
if (!std::all_of(tocs.begin() + 1, tocs.end(),
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ public:
|
|||||||
|
|
||||||
QStringList addonsPaths() const;
|
QStringList addonsPaths() const;
|
||||||
|
|
||||||
|
static void removeTocSuffixes(QString &string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Control *m_instance;
|
static Control *m_instance;
|
||||||
explicit Control(QObject *parent = nullptr);
|
explicit Control(QObject *parent = nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user