refactor: remove unused mod info and organize some stuff
This commit is contained in:
@ -3,32 +3,30 @@
|
||||
|
||||
#include "modplatform/packwiz/Packwiz.h"
|
||||
|
||||
ModFolderLoadTask::ModFolderLoadTask(QDir& mods_dir, QDir& index_dir) :
|
||||
m_mods_dir(mods_dir), m_index_dir(index_dir), m_result(new Result())
|
||||
{
|
||||
}
|
||||
ModFolderLoadTask::ModFolderLoadTask(QDir& mods_dir, QDir& index_dir)
|
||||
: m_mods_dir(mods_dir), m_index_dir(index_dir), m_result(new Result())
|
||||
{}
|
||||
|
||||
void ModFolderLoadTask::run()
|
||||
{
|
||||
// Read metadata first
|
||||
m_index_dir.refresh();
|
||||
for(auto entry : m_index_dir.entryList()){
|
||||
for (auto entry : m_index_dir.entryList()) {
|
||||
// QDir::Filter::NoDotAndDotDot seems to exclude all files for some reason...
|
||||
if(entry == "." || entry == "..")
|
||||
if (entry == "." || entry == "..")
|
||||
continue;
|
||||
|
||||
entry.chop(5); // Remove .toml at the end
|
||||
entry.chop(5); // Remove .toml at the end
|
||||
Mod mod(m_mods_dir, Packwiz::getIndexForMod(m_index_dir, entry));
|
||||
m_result->mods[mod.mmc_id()] = mod;
|
||||
m_result->mods[mod.internal_id()] = mod;
|
||||
}
|
||||
|
||||
// Read JAR files that don't have metadata
|
||||
m_mods_dir.refresh();
|
||||
for (auto entry : m_mods_dir.entryInfoList())
|
||||
{
|
||||
for (auto entry : m_mods_dir.entryInfoList()) {
|
||||
Mod mod(entry);
|
||||
if(!m_result->mods.contains(mod.mmc_id()))
|
||||
m_result->mods[mod.mmc_id()] = mod;
|
||||
if (!m_result->mods.contains(mod.internal_id()))
|
||||
m_result->mods[mod.internal_id()] = mod;
|
||||
}
|
||||
|
||||
emit succeeded();
|
||||
|
Reference in New Issue
Block a user