delete duplicate mods
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
3d84635b24
commit
60a7628dbb
@ -49,10 +49,16 @@ class BasicFolderLoadTask : public Task {
|
|||||||
connect(this, &Task::finished, this->thread(), &QThread::quit);
|
connect(this, &Task::finished, this->thread(), &QThread::quit);
|
||||||
|
|
||||||
m_dir.refresh();
|
m_dir.refresh();
|
||||||
|
QStringList names;
|
||||||
for (auto entry : m_dir.entryInfoList()) {
|
for (auto entry : m_dir.entryInfoList()) {
|
||||||
auto resource = m_create_func(entry);
|
auto resource = m_create_func(entry);
|
||||||
resource->moveToThread(m_thread_to_spawn_into);
|
if (names.contains(resource->name())) {
|
||||||
m_result->resources.insert(resource->internal_id(), resource);
|
resource->destroy();
|
||||||
|
} else {
|
||||||
|
names << resource->name();
|
||||||
|
resource->moveToThread(m_thread_to_spawn_into);
|
||||||
|
m_result->resources.insert(resource->internal_id(), resource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_aborted)
|
if (m_aborted)
|
||||||
|
@ -62,9 +62,15 @@ void ModFolderLoadTask::executeTask()
|
|||||||
|
|
||||||
// Read JAR files that don't have metadata
|
// Read JAR files that don't have metadata
|
||||||
m_mods_dir.refresh();
|
m_mods_dir.refresh();
|
||||||
|
QStringList names;
|
||||||
for (auto entry : m_mods_dir.entryInfoList()) {
|
for (auto entry : m_mods_dir.entryInfoList()) {
|
||||||
Mod* mod(new Mod(entry));
|
Mod* mod(new Mod(entry));
|
||||||
|
|
||||||
|
if (names.contains(mod->name())) {
|
||||||
|
mod->destroy(m_index_dir, true);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
names << mod->name();
|
||||||
if (mod->enabled()) {
|
if (mod->enabled()) {
|
||||||
if (m_result->mods.contains(mod->internal_id())) {
|
if (m_result->mods.contains(mod->internal_id())) {
|
||||||
m_result->mods[mod->internal_id()]->setStatus(ModStatus::Installed);
|
m_result->mods[mod->internal_id()]->setStatus(ModStatus::Installed);
|
||||||
|
Loading…
Reference in New Issue
Block a user