MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / unzip

Method unzip

launcher/modplatform/legacy_ftb/PackInstallTask.cpp:119–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void PackInstallTask::unzip()
120{
121 progress(2, 4);
122 setStatus(tr("Extracting modpack"));
123 QDir extractDir(m_stagingPath);
124
125 m_packZip.reset(new QuaZip(archivePath));
126 if(!m_packZip->open(QuaZip::mdUnzip))
127 {
128 emitFailed(tr("Failed to open modpack file %1!").arg(archivePath));
129 return;
130 }
131
132#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
133 m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), QOverload<QString, QString>::of(MMCZip::extractDir), archivePath, extractDir.absolutePath() + "/unzip");
134#else
135 m_extractFuture = QtConcurrent::run(QThreadPool::globalInstance(), MMCZip::extractDir, archivePath, extractDir.absolutePath() + "/unzip");
136#endif
137 connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::finished, this, &PackInstallTask::onUnzipFinished);
138 connect(&m_extractFutureWatcher, &QFutureWatcher<QStringList>::canceled, this, &PackInstallTask::onUnzipCanceled);
139 m_extractFutureWatcher.setFuture(m_extractFuture);
140}
141
142void PackInstallTask::onUnzipFinished()
143{

Callers

nothing calls this directly

Calls 3

runFunction · 0.85
openMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected