diff options
author | Sky <git@bunnies.cc> | 2014-01-05 00:14:10 +0000 |
---|---|---|
committer | Sky <git@bunnies.cc> | 2014-01-05 00:14:10 +0000 |
commit | 7d5fb1e99be24a884a69f3cf521aee8e310e2a6e (patch) | |
tree | 51d25c7f760eef471de31bf5b1a1e563e87def3c /logic/lists/InstanceList.cpp | |
parent | 79158144df1b606982bfa722447416c9549de860 (diff) | |
parent | e558584af0e6a168d76868e89d132aeebd0aa36a (diff) | |
download | MultiMC-7d5fb1e99be24a884a69f3cf521aee8e310e2a6e.tar MultiMC-7d5fb1e99be24a884a69f3cf521aee8e310e2a6e.tar.gz MultiMC-7d5fb1e99be24a884a69f3cf521aee8e310e2a6e.tar.lz MultiMC-7d5fb1e99be24a884a69f3cf521aee8e310e2a6e.tar.xz MultiMC-7d5fb1e99be24a884a69f3cf521aee8e310e2a6e.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'logic/lists/InstanceList.cpp')
-rw-r--r-- | logic/lists/InstanceList.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/logic/lists/InstanceList.cpp b/logic/lists/InstanceList.cpp index 48a2865a..bfd183d9 100644 --- a/logic/lists/InstanceList.cpp +++ b/logic/lists/InstanceList.cpp @@ -307,9 +307,10 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap) QLOG_INFO() << "The FTB directory specified does not exist. Please check your settings"; return; } - dir.cd("ModPacks"); - QFile f(dir.absoluteFilePath("modpacks.xml")); + auto fpath = dir.absoluteFilePath("modpacks.xml"); + QFile f(fpath); + QLOG_INFO() << "Discovering FTB instances -- " << fpath; if (!f.open(QFile::ReadOnly)) return; @@ -326,6 +327,9 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap) QXmlStreamAttributes attrs = reader.attributes(); FTBRecord record; record.dir = attrs.value("dir").toString(); + QDir test(dataDir.absoluteFilePath(record.dir)); + if(!test.exists()) + continue; record.name = attrs.value("name").toString(); record.logo = attrs.value("logo").toString(); record.mcVersion = attrs.value("mcVersion").toString(); @@ -343,11 +347,17 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap) } } f.close(); - + if(!records.size()) + { + QLOG_INFO() << "No FTB instances to load."; + return; + } + QLOG_INFO() << "Loading FTB instances! -- got " << records.size(); // process the records we acquired. for (auto record : records) { auto instanceDir = dataDir.absoluteFilePath(record.dir); + QLOG_INFO() << "Loading FTB instance from " << instanceDir; auto templateDir = dir.absoluteFilePath(record.dir); if (!QFileInfo(instanceDir).exists()) { @@ -361,6 +371,7 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap) if (!QFileInfo(PathCombine(instanceDir, "instance.cfg")).exists()) { + QLOG_INFO() << "Converting " << record.name << " as new."; BaseInstance *instPtr = NULL; auto &factory = InstanceFactory::get(); auto version = MMC->minecraftlist()->findVersion(record.mcVersion); @@ -386,6 +397,7 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap) } else { + QLOG_INFO() << "Loading existing " << record.name; BaseInstance *instPtr = NULL; auto error = InstanceFactory::get().loadInstance(instPtr, instanceDir); if (!instPtr || error != InstanceFactory::NoCreateError) @@ -419,7 +431,7 @@ InstanceList::InstListError InstanceList::loadList() QString subDir = iter.next(); if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists()) continue; - + QLOG_INFO() << "Loading MultiMC instance from " << subDir; BaseInstance *instPtr = NULL; auto error = InstanceFactory::get().loadInstance(instPtr, subDir); continueProcessInstance(instPtr, error, subDir, groupMap); @@ -534,7 +546,7 @@ void InstanceList::continueProcessInstance(BaseInstance *instPtr, const int erro { instPtr->setGroupInitial((*iter)); } - QLOG_INFO() << "Loaded instance " << instPtr->name(); + QLOG_INFO() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath(); instPtr->setParent(this); m_instances.append(std::shared_ptr<BaseInstance>(instPtr)); connect(instPtr, SIGNAL(propertiesChanged(BaseInstance *)), this, |