Fixed pack update

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-04-12 23:45:31 +03:00
parent 1a994e8aed
commit 8121a6536b
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include "ui/pages/modplatform/OptionalModDialog.h" #include "ui/pages/modplatform/OptionalModDialog.h"
#include <QAbstractButton> #include <QAbstractButton>
#include <QFileInfo>
#include <vector> #include <vector>
bool ModrinthCreationTask::abort() bool ModrinthCreationTask::abort()
@ -58,6 +59,7 @@ bool ModrinthCreationTask::updateInstance()
return false; return false;
auto version_name = inst->getManagedPackVersionName(); auto version_name = inst->getManagedPackVersionName();
m_root_path = QFileInfo(inst->gameRoot()).fileName();
auto version_str = !version_name.isEmpty() ? tr(" (version %1)").arg(version_name) : ""; auto version_str = !version_name.isEmpty() ? tr(" (version %1)").arg(version_name) : "";
if (shouldConfirmUpdate()) { if (shouldConfirmUpdate()) {
@ -173,7 +175,7 @@ bool ModrinthCreationTask::createInstance()
FS::ensureFilePathExists(new_index_place); FS::ensureFilePathExists(new_index_place);
QFile::rename(index_path, new_index_place); QFile::rename(index_path, new_index_place);
auto mcPath = FS::PathCombine(m_stagingPath, "minecraft"); auto mcPath = FS::PathCombine(m_stagingPath, m_root_path);
auto override_path = FS::PathCombine(m_stagingPath, "overrides"); auto override_path = FS::PathCombine(m_stagingPath, "overrides");
if (QFile::exists(override_path)) { if (QFile::exists(override_path)) {
@ -234,7 +236,7 @@ bool ModrinthCreationTask::createInstance()
m_files_job.reset(new NetJob(tr("Mod Download Modrinth"), APPLICATION->network())); m_files_job.reset(new NetJob(tr("Mod Download Modrinth"), APPLICATION->network()));
auto root_modpack_path = FS::PathCombine(m_stagingPath, "minecraft"); auto root_modpack_path = FS::PathCombine(m_stagingPath, m_root_path);
auto root_modpack_url = QUrl::fromLocalFile(root_modpack_path); auto root_modpack_url = QUrl::fromLocalFile(root_modpack_path);
for (auto file : m_files) { for (auto file : m_files) {

View File

@ -46,4 +46,6 @@ class ModrinthCreationTask final : public InstanceCreationTask {
NetJob::Ptr m_files_job; NetJob::Ptr m_files_job;
std::optional<InstancePtr> m_instance; std::optional<InstancePtr> m_instance;
QString m_root_path = "minecraft";
}; };