fix(Inst. Import): correctly set component versions when updating
This makes it so that the later call to parse the old manifest doesn't change the class data, so that the new data con continue there and be reflected on the component list later. Co-authored-by: Sefa Eyeoglu <contact@scrumplex.net> Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
40f16b6d62
commit
22aebc2215
@ -279,7 +279,7 @@ bool ModrinthCreationTask::createInstance()
|
||||
return ended_well;
|
||||
}
|
||||
|
||||
bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<Modrinth::File>& files, bool set_managed_info, bool show_optional_dialog)
|
||||
bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<Modrinth::File>& files, bool set_internal_data, bool show_optional_dialog)
|
||||
{
|
||||
try {
|
||||
auto doc = Json::requireDocument(index_path);
|
||||
@ -291,7 +291,7 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<
|
||||
throw JSONValidationError("Unknown game: " + game);
|
||||
}
|
||||
|
||||
if (set_managed_info) {
|
||||
if (set_internal_data) {
|
||||
if (m_managed_version_id.isEmpty())
|
||||
m_managed_version_id = Json::ensureString(obj, "versionId", {}, "Managed ID");
|
||||
m_managed_name = Json::ensureString(obj, "name", {}, "Managed Name");
|
||||
@ -367,6 +367,7 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<
|
||||
files.push_back(file);
|
||||
}
|
||||
|
||||
if (set_internal_data) {
|
||||
auto dependencies = Json::requireObject(obj, "dependencies", "modrinth.index.json");
|
||||
for (auto it = dependencies.begin(), end = dependencies.end(); it != end; ++it) {
|
||||
QString name = it.key();
|
||||
@ -382,6 +383,7 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<
|
||||
throw JSONValidationError("Unknown dependency type: " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw JSONValidationError(QStringLiteral("Unknown format version: %s").arg(formatVersion));
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class ModrinthCreationTask final : public InstanceCreationTask {
|
||||
bool createInstance() override;
|
||||
|
||||
private:
|
||||
bool parseManifest(const QString&, std::vector<Modrinth::File>&, bool set_managed_info = true, bool show_optional_dialog = true);
|
||||
bool parseManifest(const QString&, std::vector<Modrinth::File>&, bool set_internal_data = true, bool show_optional_dialog = true);
|
||||
|
||||
private:
|
||||
QWidget* m_parent = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user