DEBUG: Add some logging for instance loading.
This commit is contained in:
parent
f399207ae0
commit
c35012f1a5
@ -307,9 +307,10 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
|
|||||||
QLOG_INFO() << "The FTB directory specified does not exist. Please check your settings";
|
QLOG_INFO() << "The FTB directory specified does not exist. Please check your settings";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.cd("ModPacks");
|
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))
|
if (!f.open(QFile::ReadOnly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -326,6 +327,9 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
|
|||||||
QXmlStreamAttributes attrs = reader.attributes();
|
QXmlStreamAttributes attrs = reader.attributes();
|
||||||
FTBRecord record;
|
FTBRecord record;
|
||||||
record.dir = attrs.value("dir").toString();
|
record.dir = attrs.value("dir").toString();
|
||||||
|
QDir test(dataDir.absoluteFilePath(record.dir));
|
||||||
|
if(!test.exists())
|
||||||
|
continue;
|
||||||
record.name = attrs.value("name").toString();
|
record.name = attrs.value("name").toString();
|
||||||
record.logo = attrs.value("logo").toString();
|
record.logo = attrs.value("logo").toString();
|
||||||
record.mcVersion = attrs.value("mcVersion").toString();
|
record.mcVersion = attrs.value("mcVersion").toString();
|
||||||
@ -343,11 +347,17 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.close();
|
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.
|
// process the records we acquired.
|
||||||
for (auto record : records)
|
for (auto record : records)
|
||||||
{
|
{
|
||||||
auto instanceDir = dataDir.absoluteFilePath(record.dir);
|
auto instanceDir = dataDir.absoluteFilePath(record.dir);
|
||||||
|
QLOG_INFO() << "Loading FTB instance from " << instanceDir;
|
||||||
auto templateDir = dir.absoluteFilePath(record.dir);
|
auto templateDir = dir.absoluteFilePath(record.dir);
|
||||||
if (!QFileInfo(instanceDir).exists())
|
if (!QFileInfo(instanceDir).exists())
|
||||||
{
|
{
|
||||||
@ -361,6 +371,7 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
|
|||||||
|
|
||||||
if (!QFileInfo(PathCombine(instanceDir, "instance.cfg")).exists())
|
if (!QFileInfo(PathCombine(instanceDir, "instance.cfg")).exists())
|
||||||
{
|
{
|
||||||
|
QLOG_INFO() << "Converting " << record.name << " as new.";
|
||||||
BaseInstance *instPtr = NULL;
|
BaseInstance *instPtr = NULL;
|
||||||
auto &factory = InstanceFactory::get();
|
auto &factory = InstanceFactory::get();
|
||||||
auto version = MMC->minecraftlist()->findVersion(record.mcVersion);
|
auto version = MMC->minecraftlist()->findVersion(record.mcVersion);
|
||||||
@ -386,6 +397,7 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
QLOG_INFO() << "Loading existing " << record.name;
|
||||||
BaseInstance *instPtr = NULL;
|
BaseInstance *instPtr = NULL;
|
||||||
auto error = InstanceFactory::get().loadInstance(instPtr, instanceDir);
|
auto error = InstanceFactory::get().loadInstance(instPtr, instanceDir);
|
||||||
if (!instPtr || error != InstanceFactory::NoCreateError)
|
if (!instPtr || error != InstanceFactory::NoCreateError)
|
||||||
@ -419,7 +431,7 @@ InstanceList::InstListError InstanceList::loadList()
|
|||||||
QString subDir = iter.next();
|
QString subDir = iter.next();
|
||||||
if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists())
|
if (!QFileInfo(PathCombine(subDir, "instance.cfg")).exists())
|
||||||
continue;
|
continue;
|
||||||
|
QLOG_INFO() << "Loading MultiMC instance from " << subDir;
|
||||||
BaseInstance *instPtr = NULL;
|
BaseInstance *instPtr = NULL;
|
||||||
auto error = InstanceFactory::get().loadInstance(instPtr, subDir);
|
auto error = InstanceFactory::get().loadInstance(instPtr, subDir);
|
||||||
continueProcessInstance(instPtr, error, subDir, groupMap);
|
continueProcessInstance(instPtr, error, subDir, groupMap);
|
||||||
@ -534,7 +546,7 @@ void InstanceList::continueProcessInstance(BaseInstance *instPtr, const int erro
|
|||||||
{
|
{
|
||||||
instPtr->setGroupInitial((*iter));
|
instPtr->setGroupInitial((*iter));
|
||||||
}
|
}
|
||||||
QLOG_INFO() << "Loaded instance " << instPtr->name();
|
QLOG_INFO() << "Loaded instance " << instPtr->name() << " from " << dir.absolutePath();
|
||||||
instPtr->setParent(this);
|
instPtr->setParent(this);
|
||||||
m_instances.append(std::shared_ptr<BaseInstance>(instPtr));
|
m_instances.append(std::shared_ptr<BaseInstance>(instPtr));
|
||||||
connect(instPtr, SIGNAL(propertiesChanged(BaseInstance *)), this,
|
connect(instPtr, SIGNAL(propertiesChanged(BaseInstance *)), this,
|
||||||
|
Loading…
Reference in New Issue
Block a user