diff options
Diffstat (limited to 'libmultimc/src/instance.cpp')
-rw-r--r-- | libmultimc/src/instance.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libmultimc/src/instance.cpp b/libmultimc/src/instance.cpp index f9e105c7..f4a6a3c9 100644 --- a/libmultimc/src/instance.cpp +++ b/libmultimc/src/instance.cpp @@ -22,6 +22,7 @@ #include "overridesetting.h" #include "pathutils.h" +#include <minecraftversionlist.h> Instance::Instance(const QString &rootDir, QObject *parent) : QObject(parent) @@ -151,6 +152,39 @@ QString Instance::modListFile() const return PathCombine(rootDir(), "modlist"); } +InstVersionList *Instance::versionList() const +{ + return &MinecraftVersionList::getMainList(); +} + +bool Instance::shouldUpdateCurrentVersion() +{ + QFileInfo jar(mcJar()); + return jar.lastModified().toUTC().toMSecsSinceEpoch() != lastCurrentVersionUpdate(); +} + +void Instance::updateCurrentVersion(bool keepCurrent) +{ + QFileInfo jar(mcJar()); + + if(!jar.exists()) + { + setLastCurrentVersionUpdate(0); + setCurrentVersion("Unknown"); + return; + } + + qint64 time = jar.lastModified().toUTC().toMSecsSinceEpoch(); + + setLastCurrentVersionUpdate(time); + if (!keepCurrent) + { + // TODO: Implement GetMinecraftJarVersion function. + QString newVersion = "Unknown";//javautils::GetMinecraftJarVersion(jar.absoluteFilePath()); + setCurrentVersion(newVersion); + } +} + SettingsObject &Instance::settings() const { return *m_settings; |