delete duplicate mods

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-10-26 20:43:26 +03:00
parent 3d84635b24
commit 60a7628dbb
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 14 additions and 2 deletions

View File

@ -49,11 +49,17 @@ class BasicFolderLoadTask : public Task {
connect(this, &Task::finished, this->thread(), &QThread::quit);
m_dir.refresh();
QStringList names;
for (auto entry : m_dir.entryInfoList()) {
auto resource = m_create_func(entry);
if (names.contains(resource->name())) {
resource->destroy();
} else {
names << resource->name();
resource->moveToThread(m_thread_to_spawn_into);
m_result->resources.insert(resource->internal_id(), resource);
}
}
if (m_aborted)
emit finished();

View File

@ -62,9 +62,15 @@ void ModFolderLoadTask::executeTask()
// Read JAR files that don't have metadata
m_mods_dir.refresh();
QStringList names;
for (auto entry : m_mods_dir.entryInfoList()) {
Mod* mod(new Mod(entry));
if (names.contains(mod->name())) {
mod->destroy(m_index_dir, true);
continue;
}
names << mod->name();
if (mod->enabled()) {
if (m_result->mods.contains(mod->internal_id())) {
m_result->mods[mod->internal_id()]->setStatus(ModStatus::Installed);