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

Method install

launcher/minecraft/World.cpp:319–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319bool World::install(const QString &to, const QString &name)
320{
321 auto finalPath = FS::PathCombine(to, FS::DirNameFromString(m_actualName, to));
322 if(!FS::ensureFolderPathExists(finalPath))
323 {
324 return false;
325 }
326 bool ok = false;
327 if(m_containerFile.isFile())
328 {
329 QuaZip zip(m_containerFile.absoluteFilePath());
330 if (!zip.open(QuaZip::mdUnzip))
331 {
332 return false;
333 }
334 ok = !MMCZip::extractSubDir(&zip, m_containerOffsetPath, finalPath);
335 }
336 else if(m_containerFile.isDir())
337 {
338 QString from = m_containerFile.filePath();
339 ok = FS::copy(from, finalPath)();
340 }
341
342 if(ok && !name.isEmpty() && m_actualName != name)
343 {
344 QFileInfo finalPathInfo(finalPath);
345 World newWorld(finalPathInfo);
346 if(newWorld.isValid())
347 {
348 newWorld.rename(name);
349 }
350 }
351 return ok;
352}
353
354bool World::rename(const QString &newName)
355{

Callers 2

installWorldMethod · 0.45

Calls 9

PathCombineFunction · 0.85
DirNameFromStringFunction · 0.85
ensureFolderPathExistsFunction · 0.85
copyClass · 0.85
openMethod · 0.80
filePathMethod · 0.80
isEmptyMethod · 0.80
renameMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected