aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/technic/SolderPackInstallTask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/modplatform/technic/SolderPackInstallTask.cpp')
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.cpp40
1 files changed, 13 insertions, 27 deletions
diff --git a/launcher/modplatform/technic/SolderPackInstallTask.cpp b/launcher/modplatform/technic/SolderPackInstallTask.cpp
index 6a05d17a..ad564de0 100644
--- a/launcher/modplatform/technic/SolderPackInstallTask.cpp
+++ b/launcher/modplatform/technic/SolderPackInstallTask.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (c) 2021-2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* This program is free software: you can redistribute it and/or modify
@@ -96,8 +96,7 @@ void Technic::SolderPackInstallTask::fileListSucceeded()
TechnicSolder::PackBuild build;
try {
TechnicSolder::loadPackBuild(build, obj);
- }
- catch (const JSONValidationError& e) {
+ } catch (const JSONValidationError& e) {
emitFailed(tr("Could not understand pack manifest:\n") + e.cause());
m_filesNetJob.reset();
return;
@@ -126,7 +125,7 @@ void Technic::SolderPackInstallTask::fileListSucceeded()
connect(m_filesNetJob.get(), &NetJob::succeeded, this, &Technic::SolderPackInstallTask::downloadSucceeded);
connect(m_filesNetJob.get(), &NetJob::progress, this, &Technic::SolderPackInstallTask::downloadProgressChanged);
- connect(m_filesNetJob.get(), &NetJob::stepProgress, this, &Technic::SolderPackInstallTask::propogateStepProgress);
+ connect(m_filesNetJob.get(), &NetJob::stepProgress, this, &Technic::SolderPackInstallTask::propagateStepProgress);
connect(m_filesNetJob.get(), &NetJob::failed, this, &Technic::SolderPackInstallTask::downloadFailed);
connect(m_filesNetJob.get(), &NetJob::aborted, this, &Technic::SolderPackInstallTask::downloadAborted);
m_filesNetJob->start();
@@ -138,17 +137,14 @@ void Technic::SolderPackInstallTask::downloadSucceeded()
setStatus(tr("Extracting modpack"));
m_filesNetJob.reset();
- m_extractFuture = QtConcurrent::run([this]()
- {
+ m_extractFuture = QtConcurrent::run([this]() {
int i = 0;
QString extractDir = FS::PathCombine(m_stagingPath, ".minecraft");
FS::ensureFolderPathExists(extractDir);
- while (m_modCount > i)
- {
+ while (m_modCount > i) {
auto path = FS::PathCombine(m_outputDir.path(), QString("%1").arg(i));
- if (!MMCZip::extractDir(path, extractDir))
- {
+ if (!MMCZip::extractDir(path, extractDir)) {
return false;
}
i++;
@@ -181,8 +177,7 @@ void Technic::SolderPackInstallTask::downloadAborted()
void Technic::SolderPackInstallTask::extractFinished()
{
- if (!m_extractFuture.result())
- {
+ if (!m_extractFuture.result()) {
emitFailed(tr("Failed to extract modpack"));
return;
}
@@ -190,30 +185,22 @@ void Technic::SolderPackInstallTask::extractFinished()
qDebug() << "Fixing permissions for extracted pack files...";
QDirIterator it(extractDir, QDirIterator::Subdirectories);
- while (it.hasNext())
- {
+ while (it.hasNext()) {
auto filepath = it.next();
QFileInfo file(filepath);
auto permissions = QFile::permissions(filepath);
auto origPermissions = permissions;
- if(file.isDir())
- {
+ if (file.isDir()) {
// Folder +rwx for current user
permissions |= QFileDevice::Permission::ReadUser | QFileDevice::Permission::WriteUser | QFileDevice::Permission::ExeUser;
- }
- else
- {
+ } else {
// File +rw for current user
permissions |= QFileDevice::Permission::ReadUser | QFileDevice::Permission::WriteUser;
}
- if(origPermissions != permissions)
- {
- if(!QFile::setPermissions(filepath, permissions))
- {
+ if (origPermissions != permissions) {
+ if (!QFile::setPermissions(filepath, permissions)) {
logWarning(tr("Could not fix permissions for %1").arg(filepath));
- }
- else
- {
+ } else {
qDebug() << "Fixed" << filepath;
}
}
@@ -229,4 +216,3 @@ void Technic::SolderPackInstallTask::extractAborted()
{
emitFailed(tr("Instance import has been aborted."));
}
-