summaryrefslogtreecommitdiffstats
path: root/logic/DerpInstance.cpp
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-01-22 15:20:48 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-01-22 15:20:48 +0100
commit0a592ab99bc68ad918f74206edf2a77cc257683c (patch)
tree9222c666b871f0e49bb1b6150d102bca8d2b552c /logic/DerpInstance.cpp
parentd166b4807223ec7cd0df6f26e05a2f364dc6121c (diff)
downloadMultiMC-0a592ab99bc68ad918f74206edf2a77cc257683c.tar
MultiMC-0a592ab99bc68ad918f74206edf2a77cc257683c.tar.gz
MultiMC-0a592ab99bc68ad918f74206edf2a77cc257683c.tar.lz
MultiMC-0a592ab99bc68ad918f74206edf2a77cc257683c.tar.xz
MultiMC-0a592ab99bc68ad918f74206edf2a77cc257683c.zip
Work towards liteloader support. Fix creating new instance
Diffstat (limited to 'logic/DerpInstance.cpp')
-rw-r--r--logic/DerpInstance.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/logic/DerpInstance.cpp b/logic/DerpInstance.cpp
index 672ba6c4..e6b92b1f 100644
--- a/logic/DerpInstance.cpp
+++ b/logic/DerpInstance.cpp
@@ -35,10 +35,16 @@ DerpInstance::DerpInstance(const QString &rootDir, SettingsObject *settings, QOb
d->m_settings->registerSetting("IntendedVersion", "");
d->m_settings->registerSetting("ShouldUpdate", false);
d->version.reset(new DerpVersion(this, this));
- reloadFullVersion();
+ if (QDir(instanceRoot()).exists("version.json"))
+ {
+ reloadFullVersion();
+ }
+ else
+ {
+ clearFullVersion();
+ }
}
-
std::shared_ptr<Task> DerpInstance::doUpdate(bool only_prepare)
{
return std::shared_ptr<Task>(new DerpUpdate(this, only_prepare));
@@ -280,9 +286,8 @@ bool DerpInstance::setIntendedVersionId(QString version)
{
settings().set("IntendedVersion", version);
setShouldUpdate(true);
- auto pathOrig = PathCombine(instanceRoot(), "version.json");
- QFile::remove(pathOrig);
- reloadFullVersion();
+ QFile::remove(PathCombine(instanceRoot(), "version.json"));
+ clearFullVersion();
return true;
}
@@ -327,6 +332,13 @@ bool DerpInstance::reloadFullVersion(QWidget *widgetParent)
return ret;
}
+void DerpInstance::clearFullVersion()
+{
+ I_D(DerpInstance);
+ d->version->clear();
+ emit versionReloaded();
+}
+
std::shared_ptr<DerpVersion> DerpInstance::getFullVersion()
{
I_D(DerpInstance);