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

Method installEmpty

launcher/minecraft/PackProfile.cpp:714–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712}
713
714bool PackProfile::installEmpty(const QString& uid, const QString& name)
715{
716 QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
717 if (!FS::ensureFolderPathExists(patchDir)) {
718 return false;
719 }
720 auto f = std::make_shared<VersionFile>();
721 f->name = name;
722 f->uid = uid;
723 f->version = "1";
724 QString patchFileName = FS::PathCombine(patchDir, uid + ".json");
725 QFile file(patchFileName);
726 if (!file.open(QFile::WriteOnly)) {
727 qCCritical(instanceProfileC) << d->m_instance->name() << "|" << "Error opening" << file.fileName()
728 << "for reading:" << file.errorString();
729 return false;
730 }
731 file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
732 file.close();
733
734 appendComponent(makeShared<Component>(this, f->uid, f));
735 scheduleSave();
736 invalidateLaunchProfile();
737 return true;
738}
739
740bool PackProfile::removeComponent_internal(ComponentPtr patch)
741{

Callers 1

Calls 9

PathCombineFunction · 0.85
ensureFolderPathExistsFunction · 0.85
instanceRootMethod · 0.80
openMethod · 0.80
errorStringMethod · 0.80
toJsonMethod · 0.80
closeMethod · 0.80
nameMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected