+
Prism Launcher is a custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once.
This is a **fork** of the MultiMC Launcher and not endorsed by MultiMC.
+
## Installation
- All downloads and instructions for Prism Launcher can be found [on our website](https://prismlauncher.org/download/).
@@ -16,25 +18,24 @@ This is a **fork** of the MultiMC Launcher and not endorsed by MultiMC.
There are development builds available [here](https://github.com/PrismLauncher/PrismLauncher/actions). These have debug information in the binaries, so their file sizes are relatively larger.
-Portable builds are provided for on Linux, Windows, and macOS.
+Portable builds are provided for Linux, Windows, and macOS.
+
+For Arch, Debian and Gentoo, respectively, you can use these packages to get compiled development versions:
+
+[![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--git-blue?style=flat-square&logo=appveyor)](https://aur.archlinux.org/packages/prismlauncher-qt5-git/) [![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--qt5--git-blue?style=flat-square&logo=appveyor)](https://aur.archlinux.org/packages/prismlauncher-git/) [![prismlauncher-git](https://img.shields.io/badge/mpr-prismlauncher--git-orange?style=flat-square&logo=appveyor)](https://mpr.makedeb.org/packages/prismlauncher-git) [![prismlauncher-9999](https://img.shields.io/badge/gentoo-prismlauncher--9999-purple?style=flat-square&logo=appveyor)](https://packages.gentoo.org/packages/games-action/prismlauncher)
-For Debian and Arch, you can use these packages for the latest development versions:
-[![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--git-blue)](https://aur.archlinux.org/packages/prismlauncher-git/)
-[![prismlauncher-git](https://img.shields.io/badge/mpr-prismlauncher--git-orange)](https://mpr.makedeb.org/packages/prismlauncher-git)
## Help & Support
-Feel free to create an issue if you need help. However, you might find it easier to ask in the Discord server.
+Feel free to create an issue if you need help.
+#### Join our Discord server:
[![Prism Launcher Discord server](https://discordapp.com/api/guilds/1031648380885147709/widget.png?style=banner3)](https://discord.gg/prismlauncher)
-We will also soon be opening up our Matrix channels.
-You can already join our Matrix space:
+#### Join our Matrix space:
+[![PrismLauncher Space](https://img.shields.io/matrix/prismlauncher:matrix.org?style=for-the-badge&logo=appveyor)](https://matrix.to/#/#prismlauncher:matrix.org)
-[![PrismLauncher Space](https://img.shields.io/matrix/prismlauncher:matrix.org?label=PrismLauncher%20space)](https://matrix.to/#/#prismlauncher:matrix.org)
-
-We also have a subreddit you can post your issues and suggestions on:
-
-[r/PrismLauncher](https://www.reddit.com/r/PrismLauncher/)
+#### Join our SubReddit:
+[![r/PrismLauncher](https://img.shields.io/reddit/subreddit-subscribers/prismlauncher?style=for-the-badge&logo=appveyor)](https://www.reddit.com/r/PrismLauncher/)
## Building
@@ -60,13 +61,11 @@ Be aware that if you build this software without removing the provided API keys
If you do not agree with these terms and conditions, then remove the associated API keys from the [CMakeLists.txt](CMakeLists.txt) file by setting them to an empty string (`""`).
-## License
+## Sponsors & Partners
-All launcher code is available under the GPL-3.0-only license.
-
-The logo and related assets are under the CC BY-SA 4.0 license.
+We thank all the wonderful backers over at Open Collective! Support Prism Launcher by [becoming a backer](https://opencollective.com/prismlauncher).
-## Sponsors
+[![OpenCollective Backers](https://opencollective.com/prismlauncher/backers.svg?width=890&limit=1000)](https://opencollective.com/prismlauncher#backers)
Thanks to JetBrains for providing us a few licenses for all their products, as part of their [Open Source program](https://www.jetbrains.com/opensource/).
@@ -85,3 +84,12 @@ Thanks to Netlify for providing us their excellent web services, as part of thei
Thanks to the awesome people over at [MacStadium](https://www.macstadium.com/), for providing M1-Macs for development purposes!
+
+
+## License
+
+All launcher code is available under the GPL-3.0-only license.
+
+![https://github.com/PrismLauncher/PrismLauncher/blob/develop/LICENSE](https://img.shields.io/github/license/PrismLauncher/PrismLauncher?style=for-the-badge)
+
+The logo and related assets are under the CC BY-SA 4.0 license.
From 990cfb7b3378aa5c4f0482c1f6ef4bfa8b073e81 Mon Sep 17 00:00:00 2001
From: Adrien <66513643+AshtakaOOf@users.noreply.github.com>
Date: Thu, 27 Oct 2022 18:08:56 +0200
Subject: [PATCH 38/72] Remove appveyor
I forgor :skull:
But seriously I forgor to remove the &logo=appveyor thing AAAAAH!!!
Signed-off-by: Adrien <66513643+AshtakaOOf@users.noreply.github.com>
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index dc6cdbc7..db0e2c62 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Portable builds are provided for Linux, Windows, and macOS.
For Arch, Debian and Gentoo, respectively, you can use these packages to get compiled development versions:
-[![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--git-blue?style=flat-square&logo=appveyor)](https://aur.archlinux.org/packages/prismlauncher-qt5-git/) [![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--qt5--git-blue?style=flat-square&logo=appveyor)](https://aur.archlinux.org/packages/prismlauncher-git/) [![prismlauncher-git](https://img.shields.io/badge/mpr-prismlauncher--git-orange?style=flat-square&logo=appveyor)](https://mpr.makedeb.org/packages/prismlauncher-git) [![prismlauncher-9999](https://img.shields.io/badge/gentoo-prismlauncher--9999-purple?style=flat-square&logo=appveyor)](https://packages.gentoo.org/packages/games-action/prismlauncher)
+[![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--git-blue?style=flat-square)](https://aur.archlinux.org/packages/prismlauncher-qt5-git/) [![prismlauncher-git](https://img.shields.io/badge/aur-prismlauncher--qt5--git-blue?style=flat-square)](https://aur.archlinux.org/packages/prismlauncher-git/) [![prismlauncher-git](https://img.shields.io/badge/mpr-prismlauncher--git-orange?style=flat-square)](https://mpr.makedeb.org/packages/prismlauncher-git) [![prismlauncher-9999](https://img.shields.io/badge/gentoo-prismlauncher--9999-purple?style=flat-square)](https://packages.gentoo.org/packages/games-action/prismlauncher)
## Help & Support
@@ -32,10 +32,10 @@ Feel free to create an issue if you need help.
[![Prism Launcher Discord server](https://discordapp.com/api/guilds/1031648380885147709/widget.png?style=banner3)](https://discord.gg/prismlauncher)
#### Join our Matrix space:
-[![PrismLauncher Space](https://img.shields.io/matrix/prismlauncher:matrix.org?style=for-the-badge&logo=appveyor)](https://matrix.to/#/#prismlauncher:matrix.org)
+[![PrismLauncher Space](https://img.shields.io/matrix/prismlauncher:matrix.org?style=for-the-badge)](https://matrix.to/#/#prismlauncher:matrix.org)
#### Join our SubReddit:
-[![r/PrismLauncher](https://img.shields.io/reddit/subreddit-subscribers/prismlauncher?style=for-the-badge&logo=appveyor)](https://www.reddit.com/r/PrismLauncher/)
+[![r/PrismLauncher](https://img.shields.io/reddit/subreddit-subscribers/prismlauncher?style=for-the-badge)](https://www.reddit.com/r/PrismLauncher/)
## Building
From b18466da8430ba782e59f50812f3724defa1f2a9 Mon Sep 17 00:00:00 2001
From: TheLastRar
Date: Thu, 27 Oct 2022 12:29:41 +0100
Subject: [PATCH 39/72] Fix: Don't specify x86 in manifest
Signed-off-by: TheLastRar
---
program_info/prismlauncher.manifest.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/program_info/prismlauncher.manifest.in b/program_info/prismlauncher.manifest.in
index 1d764445..6f4467c7 100644
--- a/program_info/prismlauncher.manifest.in
+++ b/program_info/prismlauncher.manifest.in
@@ -10,7 +10,7 @@
-
+ Custom Minecraft launcher for managing multiple installs.
From d35c985d2ebca44903bedba87c99efb8db0f158d Mon Sep 17 00:00:00 2001
From: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
Date: Sun, 23 Oct 2022 12:57:29 +0200
Subject: [PATCH 40/72] feat(actions): use clang32 for building on windows
*way* faster
Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
---
.github/workflows/build.yml | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b6400791..a7dd31d7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -30,12 +30,12 @@ jobs:
- os: windows-2022
name: "Windows-Legacy"
- msystem: mingw32
+ msystem: clang32
qt_ver: 5
- os: windows-2022
name: "Windows"
- msystem: mingw32
+ msystem: clang32
qt_ver: 6
- os: macos-12
@@ -89,6 +89,7 @@ jobs:
update: true
install: >-
git
+ mingw-w64-x86_64-binutils
pacboy: >-
toolchain:p
cmake:p
@@ -99,7 +100,6 @@ jobs:
qt${{ matrix.qt_ver }}-imageformats:p
quazip-qt${{ matrix.qt_ver }}:p
ccache:p
- nsis:p
${{ matrix.qt_ver == 6 && 'qt6-5compat:p' || '' }}
- name: Setup ccache
@@ -194,7 +194,7 @@ jobs:
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
- cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -G Ninja
+ cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -G Ninja
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
@@ -280,7 +280,7 @@ jobs:
cd ${{ env.INSTALL_DIR }}
if [ "${{ matrix.qt_ver }}" == "5" ]; then
- cp /mingw32/bin/libcrypto-1_1.dll /mingw32/bin/libssl-1_1.dll ./
+ cp /clang32/bin/libcrypto-1_1.dll /clang32/bin/libssl-1_1.dll ./
fi
- name: Package (Windows, portable)
@@ -292,7 +292,6 @@ jobs:
- name: Package (Windows, installer)
if: runner.os == 'Windows'
- shell: msys2 {0}
run: |
cd ${{ env.INSTALL_DIR }}
makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi"
From 2ba3de79d8df31d196f0cd249b1606e7233cf840 Mon Sep 17 00:00:00 2001
From: Sefa Eyeoglu
Date: Thu, 27 Oct 2022 21:14:30 +0200
Subject: [PATCH 41/72] chore: add comment about copy bug
Signed-off-by: Sefa Eyeoglu
---
launcher/FileSystem.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 39e68c20..76cfccb0 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -401,6 +401,7 @@ bool overrideFolder(QString overwritten_path, QString override_path)
std::error_code err;
fs::copy_options opt = copy_opts::recursive | copy_opts::overwrite_existing;
+ // FIXME: hello traveller! Apparently std::copy does NOT overwrite existing files on GNU libstdc++ on Windows?
fs::copy(toStdString(override_path), toStdString(overwritten_path), opt, err);
if (err) {
From 93894f62ffcb8c33caf36e8801e163738cc2873d Mon Sep 17 00:00:00 2001
From: Sefa Eyeoglu
Date: Fri, 28 Oct 2022 00:05:11 +0200
Subject: [PATCH 42/72] fix: avoid segfault for unexpected API reponse
Signed-off-by: Sefa Eyeoglu
---
.../modrinth/ModrinthPackIndex.cpp | 55 +++++++++++--------
1 file changed, 31 insertions(+), 24 deletions(-)
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
index 3e53becb..ae45e096 100644
--- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
@@ -1,20 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
-* PolyMC - Minecraft Launcher
-* Copyright (c) 2022 flowln
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, version 3.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*/
+ * PolyMC - Minecraft Launcher
+ * Copyright (c) 2022 flowln
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
#include "ModrinthPackIndex.h"
#include "ModrinthAPI.h"
@@ -35,7 +35,7 @@ void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
pack.provider = ModPlatform::Provider::MODRINTH;
pack.name = Json::requireString(obj, "title");
-
+
pack.slug = Json::ensureString(obj, "slug", "");
if (!pack.slug.isEmpty())
pack.websiteUrl = "https://modrinth.com/mod/" + pack.slug;
@@ -59,23 +59,23 @@ void Modrinth::loadIndexedPack(ModPlatform::IndexedPack& pack, QJsonObject& obj)
void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& obj)
{
pack.extraData.issuesUrl = Json::ensureString(obj, "issues_url");
- if(pack.extraData.issuesUrl.endsWith('/'))
+ if (pack.extraData.issuesUrl.endsWith('/'))
pack.extraData.issuesUrl.chop(1);
pack.extraData.sourceUrl = Json::ensureString(obj, "source_url");
- if(pack.extraData.sourceUrl.endsWith('/'))
+ if (pack.extraData.sourceUrl.endsWith('/'))
pack.extraData.sourceUrl.chop(1);
pack.extraData.wikiUrl = Json::ensureString(obj, "wiki_url");
- if(pack.extraData.wikiUrl.endsWith('/'))
+ if (pack.extraData.wikiUrl.endsWith('/'))
pack.extraData.wikiUrl.chop(1);
pack.extraData.discordUrl = Json::ensureString(obj, "discord_url");
- if(pack.extraData.discordUrl.endsWith('/'))
+ if (pack.extraData.discordUrl.endsWith('/'))
pack.extraData.discordUrl.chop(1);
auto donate_arr = Json::ensureArray(obj, "donation_urls");
- for(auto d : donate_arr){
+ for (auto d : donate_arr) {
auto d_obj = Json::requireObject(d);
ModPlatform::DonationData donate;
@@ -104,7 +104,7 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
auto obj = versionIter.toObject();
auto file = loadIndexedPackVersion(obj);
- if(file.fileId.isValid()) // Heuristic to check if the returned value is valid
+ if (file.fileId.isValid()) // Heuristic to check if the returned value is valid
unsortedVersions.append(file);
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
@@ -116,7 +116,8 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
pack.versionsLoaded = true;
}
-auto Modrinth::loadIndexedPackVersion(QJsonObject &obj, QString preferred_hash_type, QString preferred_file_name) -> ModPlatform::IndexedVersion
+auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_type, QString preferred_file_name)
+ -> ModPlatform::IndexedVersion
{
ModPlatform::IndexedVersion file;
@@ -141,6 +142,12 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject &obj, QString preferred_hash_t
auto files = Json::requireArray(obj, "files");
int i = 0;
+ if (files.empty()) {
+ // This should not happen normally, but check just in case
+ qWarning() << "Modrinth returned an unexpected empty list of files:" << obj;
+ return {};
+ }
+
// Find correct file (needed in cases where one version may have multiple files)
// Will default to the last one if there's no primary (though I think Modrinth requires that
// at least one file is primary, idk)
@@ -167,7 +174,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject &obj, QString preferred_hash_t
file.fileName = Json::requireString(parent, "filename");
file.is_preferred = Json::requireBoolean(parent, "primary") || (files.count() == 1);
auto hash_list = Json::requireObject(parent, "hashes");
-
+
if (hash_list.contains(preferred_hash_type)) {
file.hash = Json::requireString(hash_list, preferred_hash_type);
file.hash_type = preferred_hash_type;
From a5be974f1a53a8e56527d639beb4c16f3a7e18c6 Mon Sep 17 00:00:00 2001
From: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
Date: Thu, 27 Oct 2022 21:05:32 +0200
Subject: [PATCH 43/72] feat: use clang64 on qt6 builds
Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ca82d3d8..dd2c0599 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -35,7 +35,7 @@ jobs:
- os: windows-2022
name: "Windows"
- msystem: clang32
+ msystem: clang64
qt_ver: 6
- os: macos-12
From e6e92f2b0e9ef16bdbae371ccb284339a70cff02 Mon Sep 17 00:00:00 2001
From: flow
Date: Fri, 28 Oct 2022 13:31:21 -0300
Subject: [PATCH 44/72] fix: only allow workarounds for blocked mods from MR
when 100% safe
If a version on Modrinth has more than a single mod loader associated,
it means that it's possible we might get the wrong file for download,
since individual files don't really have this kind of metadata in the
API response.
So, in such cases, it's best to let the user take care of it instead.
Signed-off-by: flow
---
.../modplatform/flame/FileResolvingTask.cpp | 23 +++++++++++--------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp
index c50abb8f..25b56fbd 100644
--- a/launcher/modplatform/flame/FileResolvingTask.cpp
+++ b/launcher/modplatform/flame/FileResolvingTask.cpp
@@ -3,6 +3,8 @@
#include "Json.h"
#include "net/Upload.h"
+#include "modplatform/modrinth/ModrinthPackIndex.h"
+
Flame::FileResolvingTask::FileResolvingTask(const shared_qobject_ptr& network, Flame::Manifest& toProcess)
: m_network(network), m_toProcess(toProcess)
{}
@@ -84,18 +86,21 @@ void Flame::FileResolvingTask::modrinthCheckFinished() {
delete bytes;
continue;
}
+
QJsonDocument doc = QJsonDocument::fromJson(*bytes);
auto obj = doc.object();
- auto array = Json::requireArray(obj,"files");
- for (auto file: array) {
- auto fileObj = Json::requireObject(file);
- auto primary = Json::requireBoolean(fileObj,"primary");
- if (primary) {
- out->url = Json::requireUrl(fileObj,"url");
- qDebug() << "Found alternative on modrinth " << out->fileName;
- break;
- }
+ auto file = Modrinth::loadIndexedPackVersion(obj);
+
+ // If there's more than one mod loader for this version, we can't know for sure
+ // which file is relative to each loader, so it's best to not use any one and
+ // let the user download it manually.
+ if (file.loaders.size() <= 1) {
+ out->url = file.downloadUrl;
+ qDebug() << "Found alternative on modrinth " << out->fileName;
+ } else {
+ out->resolved = false;
}
+
delete bytes;
}
//copy to an output list and filter out projects found on modrinth
From 76146e0f17dc56a68128edb13a73f4852af86e84 Mon Sep 17 00:00:00 2001
From: leo78913
Date: Fri, 28 Oct 2022 15:51:20 -0300
Subject: [PATCH 45/72] add a flat white version of the launch icon
Signed-off-by: leo78913
---
launcher/resources/flat_white/flat_white.qrc | 1 +
.../resources/flat_white/scalable/launch.svg | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 launcher/resources/flat_white/scalable/launch.svg
diff --git a/launcher/resources/flat_white/flat_white.qrc b/launcher/resources/flat_white/flat_white.qrc
index 9df69060..e11d6316 100644
--- a/launcher/resources/flat_white/flat_white.qrc
+++ b/launcher/resources/flat_white/flat_white.qrc
@@ -46,5 +46,6 @@
scalable/export.svgscalable/rename.svgscalable/tag.svg
+ scalable/launch.svg
diff --git a/launcher/resources/flat_white/scalable/launch.svg b/launcher/resources/flat_white/scalable/launch.svg
new file mode 100644
index 00000000..9e759431
--- /dev/null
+++ b/launcher/resources/flat_white/scalable/launch.svg
@@ -0,0 +1,16 @@
+
+
From be3c9abcfeb68ad76914848e7135b2595490beda Mon Sep 17 00:00:00 2001
From: flow
Date: Fri, 28 Oct 2022 20:11:46 -0300
Subject: [PATCH 46/72] fix: copy single files too in FS::copy
eek
Signed-off-by: flow
---
launcher/FileSystem.cpp | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 76cfccb0..9bca847e 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -182,6 +182,21 @@ bool copy::operator()(const QString& offset)
if (!m_followSymlinks)
opt |= copy_opts::copy_symlinks;
+ // Function that'll do the actual copying
+ auto copy_file = [&](QString src_path, QString relative_dst_path) {
+ if (m_blacklist && m_blacklist->matches(relative_dst_path))
+ return;
+
+ auto dst_path = PathCombine(dst, relative_dst_path);
+ ensureFilePathExists(dst_path);
+
+ fs::copy(toStdString(src_path), toStdString(dst_path), opt, err);
+ if (err) {
+ qWarning() << "Failed to copy files:" << QString::fromStdString(err.message());
+ qDebug() << "Source file:" << src_path;
+ qDebug() << "Destination file:" << dst_path;
+ }
+ };
// We can't use copy_opts::recursive because we need to take into account the
// blacklisted paths, so we iterate over the source directory, and if there's no blacklist
@@ -193,20 +208,13 @@ bool copy::operator()(const QString& offset)
auto src_path = source_it.next();
auto relative_path = src_dir.relativeFilePath(src_path);
- if (m_blacklist && m_blacklist->matches(relative_path))
- continue;
-
- auto dst_path = PathCombine(dst, relative_path);
- ensureFilePathExists(dst_path);
-
- fs::copy(toStdString(src_path), toStdString(dst_path), opt, err);
- if (err) {
- qWarning() << "Failed to copy files:" << QString::fromStdString(err.message());
- qDebug() << "Source file:" << src_path;
- qDebug() << "Destination file:" << dst_path;
- }
+ copy_file(src_path, relative_path);
}
+ // If the root src is not a directory, the previous iterator won't run.
+ if (!fs::is_directory(toStdString(src)))
+ copy_file(src, "");
+
return err.value() == 0;
}
From 81333515e0ecfa0ad0880032808a220a3f463e30 Mon Sep 17 00:00:00 2001
From: flow
Date: Fri, 28 Oct 2022 20:55:25 -0300
Subject: [PATCH 47/72] feat(tests): add test for FS::copy with files
Signed-off-by: flow
---
tests/FileSystem_test.cpp | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/FileSystem_test.cpp b/tests/FileSystem_test.cpp
index 47a963b0..21270f6f 100644
--- a/tests/FileSystem_test.cpp
+++ b/tests/FileSystem_test.cpp
@@ -183,6 +183,32 @@ slots:
f();
}
+ void test_copy_single_file()
+ {
+ QTemporaryDir tempDir;
+ tempDir.setAutoRemove(true);
+
+ {
+ QString file = QFINDTESTDATA("testdata/FileSystem/test_folder/pack.mcmeta");
+
+ qDebug() << "From:" << file << "To:" << tempDir.path();
+
+ QDir target_dir(FS::PathCombine(tempDir.path(), "pack.mcmeta"));
+ qDebug() << tempDir.path();
+ qDebug() << target_dir.path();
+ FS::copy c(file, target_dir.filePath("pack.mcmeta"));
+ c();
+
+ auto filter = QDir::Filter::Files;
+
+ for (auto entry: target_dir.entryList(filter)) {
+ qDebug() << entry;
+ }
+
+ QVERIFY(target_dir.entryList(filter).contains("pack.mcmeta"));
+ }
+ }
+
void test_getDesktop()
{
QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
From 5ed7eb9d537558da603683d517f5537f0e4537a1 Mon Sep 17 00:00:00 2001
From: Sefa Eyeoglu
Date: Sat, 29 Oct 2022 13:12:51 +0200
Subject: [PATCH 48/72] chore: update credits
Signed-off-by: Sefa Eyeoglu
---
launcher/ui/dialogs/AboutDialog.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp
index cecda1df..52d6baef 100644
--- a/launcher/ui/dialogs/AboutDialog.cpp
+++ b/launcher/ui/dialogs/AboutDialog.cpp
@@ -97,7 +97,7 @@ QString getCreditsHtml()
stream << " \n";
stream << "