summaryrefslogtreecommitdiffstats
path: root/logic/DerpInstance.cpp
diff options
context:
space:
mode:
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);