MCPcopy Create free account
hub / github.com/MultiMC/Launcher / install

Method install

launcher/minecraft/World.cpp:277–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277bool World::install(const QString &to, const QString &name)
278{
279 auto finalPath = FS::PathCombine(to, FS::DirNameFromString(m_actualName, to));
280 if(!FS::ensureFolderPathExists(finalPath))
281 {
282 return false;
283 }
284 bool ok = false;
285 if(m_containerFile.isFile())
286 {
287 QuaZip zip(m_containerFile.absoluteFilePath());
288 if (!zip.open(QuaZip::mdUnzip))
289 {
290 return false;
291 }
292 ok = !MMCZip::extractSubDir(&zip, m_containerOffsetPath, finalPath);
293 }
294 else if(m_containerFile.isDir())
295 {
296 QString from = m_containerFile.filePath();
297 ok = FS::copy(from, finalPath)();
298 }
299
300 if(ok && !name.isEmpty() && m_actualName != name)
301 {
302 World newWorld(finalPath);
303 if(newWorld.isValid())
304 {
305 newWorld.rename(name);
306 }
307 }
308 return ok;
309}
310
311bool World::rename(const QString &newName)
312{

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