From c35012f1a570e752051c8fcbafe628fc64aa793f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 3 Jan 2014 02:42:32 +0100 Subject: DEBUG: Add some logging for instance loading. --- logic/lists/InstanceList.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'logic/lists') 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 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 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 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 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 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(instPtr)); connect(instPtr, SIGNAL(propertiesChanged(BaseInstance *)), this, -- cgit v1.2.3