aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-07-23 23:13:53 -0300
committerflow <flowlnlnln@gmail.com>2022-07-24 17:46:53 -0300
commit15ec1abb6a3acb77b36f14d3ddccc97a8df8c8e1 (patch)
tree37b513ae95cfedf24f98115f616aec076335191b /launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
parentcfda8dbb2b0aeded851d45465cc3ea4b6901229c (diff)
downloadPrismLauncher-15ec1abb6a3acb77b36f14d3ddccc97a8df8c8e1.tar.gz
PrismLauncher-15ec1abb6a3acb77b36f14d3ddccc97a8df8c8e1.tar.bz2
PrismLauncher-15ec1abb6a3acb77b36f14d3ddccc97a8df8c8e1.zip
feat: use QIODevice for calcuating the JAR hash on Modrinth
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp')
-rw-r--r--launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
index 79d8edf7..f4898591 100644
--- a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
+++ b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
@@ -46,17 +46,19 @@ void ModrinthCheckUpdate::executeTask()
if (mod->metadata()->hash_format != best_hash_type) {
QByteArray jar_data;
+ QFile file(mod->fileinfo().absoluteFilePath());
try {
- jar_data = FS::read(mod->fileinfo().absoluteFilePath());
+ file.open(QFile::ReadOnly);
} catch (FS::FileSystemException& e) {
- qCritical() << QString("Failed to open / read JAR file of %1").arg(mod->name());
+ qCritical() << QString("Failed to open JAR file of %1").arg(mod->name());
qCritical() << QString("Reason: ") << e.cause();
failed(e.what());
return;
}
- hash = QString(ProviderCaps.hash(ModPlatform::Provider::MODRINTH, jar_data, best_hash_type).toHex());
+ hash = ProviderCaps.hash(ModPlatform::Provider::MODRINTH, &file, best_hash_type);
+ file.close();
}
hashes.append(hash);