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

Method installEmpty

launcher/minecraft/PackProfile.cpp:949–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947}
948
949bool PackProfile::installEmpty(const QString& uid, const QString& name)
950{
951 QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
952 if(!FS::ensureFolderPathExists(patchDir))
953 {
954 return false;
955 }
956 auto f = std::make_shared<VersionFile>();
957 f->name = name;
958 f->uid = uid;
959 f->version = "1";
960 QString patchFileName = FS::PathCombine(patchDir, uid + ".json");
961 QFile file(patchFileName);
962 if (!file.open(QFile::WriteOnly))
963 {
964 qCritical() << "Error opening" << file.fileName()
965 << "for reading:" << file.errorString();
966 return false;
967 }
968 file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
969 file.close();
970
971 appendComponent(new Component(this, f->uid, f));
972 scheduleSave();
973 invalidateLaunchProfile();
974 return true;
975}
976
977bool PackProfile::removeComponent_internal(ComponentPtr patch)
978{

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