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

Method install

launcher/minecraft/World.cpp:296–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296bool World::install(const QString& to, const QString& name)
297{
298 auto finalPath = FS::PathCombine(to, FS::DirNameFromString(m_actualName, to));
299 if (!FS::ensureFolderPathExists(finalPath)) {
300 return false;
301 }
302 bool ok = false;
303 if (m_containerFile.isFile()) {
304 QuaZip zip(m_containerFile.absoluteFilePath());
305 if (!zip.open(QuaZip::mdUnzip)) {
306 return false;
307 }
308 ok = !MMCZip::extractSubDir(&zip, m_containerOffsetPath, finalPath);
309 } else if (m_containerFile.isDir()) {
310 QString from = m_containerFile.filePath();
311 ok = FS::copy(from, finalPath)();
312 }
313
314 if (ok && !name.isEmpty() && m_actualName != name) {
315 QFileInfo finalPathInfo(finalPath);
316 World newWorld(finalPathInfo);
317 if (newWorld.isValid()) {
318 newWorld.rename(name);
319 }
320 }
321 return ok;
322}
323
324bool World::rename(const QString& newName)
325{

Callers 2

installWorldMethod · 0.45

Calls 10

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

Tested by

no test coverage detected