summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-01-22 15:20:05 +0100
committerPetr Mrázek <peterix@gmail.com>2017-01-22 15:20:05 +0100
commitcf43abc87ef56247e3012fa0d1fcefe7cb561824 (patch)
tree5bdb1d1f4ed0f53f63f4cf65c0365af7982953e7 /api
parentc421134d4984f06275b1a9d35b3dd6e345d23d21 (diff)
downloadMultiMC-cf43abc87ef56247e3012fa0d1fcefe7cb561824.tar
MultiMC-cf43abc87ef56247e3012fa0d1fcefe7cb561824.tar.gz
MultiMC-cf43abc87ef56247e3012fa0d1fcefe7cb561824.tar.lz
MultiMC-cf43abc87ef56247e3012fa0d1fcefe7cb561824.tar.xz
MultiMC-cf43abc87ef56247e3012fa0d1fcefe7cb561824.zip
GH-1794 Only write to the instance.cfg once after copying FTB instances.
Diffstat (limited to 'api')
-rw-r--r--api/logic/BaseInstance.h2
-rw-r--r--api/logic/InstanceCopyTask.cpp2
-rw-r--r--api/logic/minecraft/ftb/OneSixFTBInstance.cpp7
-rw-r--r--api/logic/minecraft/ftb/OneSixFTBInstance.h2
4 files changed, 5 insertions, 8 deletions
diff --git a/api/logic/BaseInstance.h b/api/logic/BaseInstance.h
index 3a551a5b..462b7c66 100644
--- a/api/logic/BaseInstance.h
+++ b/api/logic/BaseInstance.h
@@ -67,7 +67,7 @@ public:
/// virtual destructor to make sure the destruction is COMPLETE
virtual ~BaseInstance() {};
- virtual void copy(const QDir &newDir) {}
+ virtual void copy(SettingsObjectPtr newSettings, const QDir &newDir) {}
virtual void init() = 0;
diff --git a/api/logic/InstanceCopyTask.cpp b/api/logic/InstanceCopyTask.cpp
index 20c09907..b1bd39ef 100644
--- a/api/logic/InstanceCopyTask.cpp
+++ b/api/logic/InstanceCopyTask.cpp
@@ -51,7 +51,7 @@ void InstanceCopyTask::copyFinished()
instanceSettings->registerSetting("InstanceType", "Legacy");
// FIXME: and this too? errors???
- m_origInstance->copy(m_stagingPath);
+ m_origInstance->copy(instanceSettings, m_stagingPath);
InstancePtr inst(new NullInstance(m_globalSettings, instanceSettings, m_stagingPath));
inst->setName(m_instName);
diff --git a/api/logic/minecraft/ftb/OneSixFTBInstance.cpp b/api/logic/minecraft/ftb/OneSixFTBInstance.cpp
index 5edad080..edf31eb7 100644
--- a/api/logic/minecraft/ftb/OneSixFTBInstance.cpp
+++ b/api/logic/minecraft/ftb/OneSixFTBInstance.cpp
@@ -15,7 +15,7 @@ OneSixFTBInstance::OneSixFTBInstance(SettingsObjectPtr globalSettings, SettingsO
m_globalSettings = globalSettings;
}
-void OneSixFTBInstance::copy(const QDir &newDir)
+void OneSixFTBInstance::copy(SettingsObjectPtr newSettings, const QDir &newDir)
{
QStringList libraryNames;
// create patch file
@@ -94,10 +94,7 @@ void OneSixFTBInstance::copy(const QDir &newDir)
}
}
// now set the target instance to be plain OneSix
- INISettingsObject settings_obj(newDir.absoluteFilePath("instance.cfg"));
- settings_obj.registerSetting("InstanceType", "Legacy");
- QString inst_type = settings_obj.get("InstanceType").toString();
- settings_obj.set("InstanceType", "OneSix");
+ newSettings->set("InstanceType", "OneSix");
}
QString OneSixFTBInstance::id() const
diff --git a/api/logic/minecraft/ftb/OneSixFTBInstance.h b/api/logic/minecraft/ftb/OneSixFTBInstance.h
index a5621685..640f609c 100644
--- a/api/logic/minecraft/ftb/OneSixFTBInstance.h
+++ b/api/logic/minecraft/ftb/OneSixFTBInstance.h
@@ -9,7 +9,7 @@ public:
explicit OneSixFTBInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir);
virtual ~OneSixFTBInstance(){};
- void copy(const QDir &newDir) override;
+ void copy(SettingsObjectPtr newSettings, const QDir &newDir) override;
virtual void createProfile() override;