MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / unzip

Method unzip

launcher/modplatform/legacy_ftb/PackInstallTask.cpp:97–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void PackInstallTask::unzip()
98{
99 setStatus(tr("Extracting modpack"));
100 setAbortable(false);
101 progress(2, 4);
102
103 QDir extractDir(m_stagingPath);
104
105 m_packZip.reset(new QuaZip(archivePath));
106 if (!m_packZip->open(QuaZip::mdUnzip)) {
107 emitFailed(tr("Failed to open modpack file %1!").arg(archivePath));
108 return;
109 }
110
111#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
112 m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), QOverload<QString, QString>::of(MMCZip::extractDir), archivePath,
113 extractDir.absolutePath() + "/unzip");
114#else
115 m_extractFuture =
116 QtConcurrent::run(QThreadPool::globalInstance(), MMCZip::extractDir, archivePath, extractDir.absolutePath() + "/unzip");
117#endif
118 connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::finished, this, &PackInstallTask::onUnzipFinished);
119 connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::canceled, this, &PackInstallTask::onUnzipCanceled);
120 m_extractFutureWatcher.setFuture(m_extractFuture);
121}
122
123void PackInstallTask::onUnzipFinished()
124{

Callers

nothing calls this directly

Calls 3

runFunction · 0.85
openMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected