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

Method loadLocalFile

launcher/meta/BaseEntity.cpp:90–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90bool Meta::BaseEntity::loadLocalFile()
91{
92 const QString fname = QDir("meta").absoluteFilePath(localFilename());
93 if (!QFile::exists(fname))
94 {
95 return false;
96 }
97 // TODO: check if the file has the expected checksum
98 try
99 {
100 auto doc = Json::requireDocument(fname, fname);
101 auto obj = Json::requireObject(doc, fname);
102 parse(obj);
103 return true;
104 }
105 catch (const Exception &e)
106 {
107 qDebug() << QString("Unable to parse file %1: %2").arg(fname, e.cause());
108 // just make sure it's gone and we never consider it again.
109 QFile::remove(fname);
110 return false;
111 }
112}
113
114void Meta::BaseEntity::load(Net::Mode loadType)
115{

Callers

nothing calls this directly

Calls 5

requireDocumentFunction · 0.85
requireObjectFunction · 0.85
QStringClass · 0.85
causeMethod · 0.80
QDirClass · 0.50

Tested by

no test coverage detected