mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-24 12:32:42 +00:00
Implemented loadList() stuff.
This commit is contained in:
@@ -15,8 +15,16 @@
|
||||
|
||||
#include "instanceloader.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "instancetype.h"
|
||||
|
||||
#include "data/inifile.h"
|
||||
|
||||
#include "util/pathutils.h"
|
||||
|
||||
InstanceLoader InstanceLoader::loader;
|
||||
|
||||
InstanceLoader::InstanceLoader() :
|
||||
QObject(NULL)
|
||||
{
|
||||
@@ -61,6 +69,22 @@ InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *inst,
|
||||
return type->loadInstance(inst, instDir);
|
||||
}
|
||||
|
||||
InstanceLoader::InstTypeError InstanceLoader::loadInstance(Instance *inst,
|
||||
const QString &instDir)
|
||||
{
|
||||
QFileInfo instConfig(PathCombine(instDir, "instance.cfg"));
|
||||
|
||||
if (!instConfig.exists())
|
||||
return NotAnInstance;
|
||||
|
||||
INIFile ini;
|
||||
ini.loadFile(instConfig.path());
|
||||
QString typeName = ini.get("type", "StdInstance").toString();
|
||||
const InstanceType *type = findType(typeName);
|
||||
|
||||
return loadInstance(inst, type, instDir);
|
||||
}
|
||||
|
||||
const InstanceType *InstanceLoader::findType(const QString &id)
|
||||
{
|
||||
if (!m_typeMap.contains(id))
|
||||
|
||||
Reference in New Issue
Block a user