GH-1794 Only write to the instance.cfg once after copying FTB instances.

This commit is contained in:
Petr Mrázek 2017-01-22 15:20:05 +01:00
parent c421134d49
commit cf43abc87e
4 changed files with 5 additions and 8 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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;