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

Method extractFinished

launcher/InstanceImportTask.cpp:196–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void InstanceImportTask::extractFinished()
197{
198 m_packZip.reset();
199 if (!m_extractFuture.result())
200 {
201 emitFailed(tr("Failed to extract modpack"));
202 return;
203 }
204 QDir extractDir(m_stagingPath);
205
206 qDebug() << "Fixing permissions for extracted pack files...";
207 QDirIterator it(extractDir, QDirIterator::Subdirectories);
208 while (it.hasNext())
209 {
210 auto filepath = it.next();
211 QFileInfo file(filepath);
212 auto permissions = QFile::permissions(filepath);
213 auto origPermissions = permissions;
214 if(file.isDir())
215 {
216 // Folder +rwx for current user
217 permissions |= QFileDevice::Permission::ReadUser | QFileDevice::Permission::WriteUser | QFileDevice::Permission::ExeUser;
218 }
219 else
220 {
221 // File +rw for current user
222 permissions |= QFileDevice::Permission::ReadUser | QFileDevice::Permission::WriteUser;
223 }
224 if(origPermissions != permissions)
225 {
226 if(!QFile::setPermissions(filepath, permissions))
227 {
228 logWarning(tr("Could not fix permissions for %1").arg(filepath));
229 }
230 else
231 {
232 qDebug() << "Fixed" << filepath;
233 }
234 }
235 }
236
237 switch(m_modpackType)
238 {
239 case ModpackType::MultiMC:
240 processMultiMC();
241 return;
242 case ModpackType::Technic:
243 processTechnic();
244 return;
245 case ModpackType::Flame:
246 processFlame();
247 return;
248 case ModpackType::Modrinth:
249 processModrinth();
250 return;
251 case ModpackType::Unknown:
252 emitFailed(tr("Archive does not contain a recognized modpack type."));
253 return;

Callers

nothing calls this directly

Calls 3

nextMethod · 0.80
resetMethod · 0.45
resultMethod · 0.45

Tested by

no test coverage detected