| 36 | } |
| 37 | |
| 38 | void ModrinthHasher::executeTask() |
| 39 | { |
| 40 | QFile file(m_path); |
| 41 | |
| 42 | try { |
| 43 | file.open(QFile::ReadOnly); |
| 44 | } catch (FS::FileSystemException& e) { |
| 45 | qCritical() << QString("Failed to open JAR file in %1").arg(m_path); |
| 46 | qCritical() << QString("Reason: ") << e.cause(); |
| 47 | |
| 48 | emitFailed("Failed to open file for hashing."); |
| 49 | return; |
| 50 | } |
| 51 | |
| 52 | auto hash_type = ProviderCaps.hashType(ModPlatform::Provider::MODRINTH).first(); |
| 53 | m_hash = ProviderCaps.hash(ModPlatform::Provider::MODRINTH, &file, hash_type); |
| 54 | |
| 55 | file.close(); |
| 56 | |
| 57 | if (m_hash.isEmpty()) { |
| 58 | emitFailed("Empty hash!"); |
| 59 | } else { |
| 60 | emitSucceeded(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void FlameHasher::executeTask() |
| 65 | { |