diff options
author | flow <flowlnlnln@gmail.com> | 2022-12-03 10:15:38 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-12-06 17:00:34 -0300 |
commit | bb386a1162db751136483a59f2cffe8d9a3d1e73 (patch) | |
tree | cf6e0691822deb7a1189ec549393fd16de117c2e /launcher/InstanceList.cpp | |
parent | 80054e4db26b85f81778f1ac53bd7c123f70fe3c (diff) | |
download | PrismLauncher-bb386a1162db751136483a59f2cffe8d9a3d1e73.tar.gz PrismLauncher-bb386a1162db751136483a59f2cffe8d9a3d1e73.tar.bz2 PrismLauncher-bb386a1162db751136483a59f2cffe8d9a3d1e73.zip |
fix(ManagedPackPage): only update the current instance exactly
Also carry on the original ID to avoid updating the wrong instance.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/InstanceList.cpp')
-rw-r--r-- | launcher/InstanceList.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/launcher/InstanceList.cpp b/launcher/InstanceList.cpp index cebd70d7..68e3e92c 100644 --- a/launcher/InstanceList.cpp +++ b/launcher/InstanceList.cpp @@ -816,7 +816,7 @@ class InstanceStaging : public Task { void childSucceded() { unsigned sleepTime = backoff(); - if (m_parent->commitStagedInstance(m_stagingPath, m_instance_name, m_groupName, m_child->shouldOverride())) + if (m_parent->commitStagedInstance(m_stagingPath, m_instance_name, m_groupName, *m_child.get())) { emitSucceeded(); return; @@ -880,25 +880,22 @@ QString InstanceList::getStagedInstancePath() return path; } -bool InstanceList::commitStagedInstance(const QString& path, InstanceName const& instanceName, const QString& groupName, bool should_override) +bool InstanceList::commitStagedInstance(const QString& path, InstanceName const& instanceName, const QString& groupName, InstanceTask const& commiting) { QDir dir; QString instID; InstancePtr inst; + auto should_override = commiting.shouldOverride(); + if (should_override) { - // This is to avoid problems when the instance folder gets manually renamed - if ((inst = getInstanceByManagedName(instanceName.originalName()))) { - instID = QFileInfo(inst->instanceRoot()).fileName(); - } else if ((inst = getInstanceByManagedName(instanceName.modifiedName()))) { - instID = QFileInfo(inst->instanceRoot()).fileName(); - } else { - instID = FS::RemoveInvalidFilenameChars(instanceName.modifiedName(), '-'); - } + instID = commiting.originalInstanceID(); } else { instID = FS::DirNameFromString(instanceName.modifiedName(), m_instDir); } + Q_ASSERT(!instID.isEmpty()); + { WatchLock lock(m_watcher, m_instDir); QString destination = FS::PathCombine(m_instDir, instID); |