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

Method installEmpty

launcher/minecraft/PackProfile.cpp:742–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

740}
741
742bool PackProfile::installEmpty(const QString& uid, const QString& name)
743{
744 QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
745 if(!FS::ensureFolderPathExists(patchDir))
746 {
747 return false;
748 }
749 auto f = std::make_shared<VersionFile>();
750 f->name = name;
751 f->uid = uid;
752 f->version = "1";
753 QString patchFileName = FS::PathCombine(patchDir, uid + ".json");
754 QFile file(patchFileName);
755 if (!file.open(QFile::WriteOnly))
756 {
757 qCritical() << "Error opening" << file.fileName()
758 << "for reading:" << file.errorString();
759 return false;
760 }
761 file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
762 file.close();
763
764 appendComponent(new Component(this, f->uid, f));
765 scheduleSave();
766 invalidateLaunchProfile();
767 return true;
768}
769
770bool PackProfile::removeComponent_internal(ComponentPtr patch)
771{

Callers 1

Calls 6

PathCombineFunction · 0.85
ensureFolderPathExistsFunction · 0.85
instanceRootMethod · 0.80
openMethod · 0.80
toJsonMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected