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

Function putLevelDatDataToFS

launcher/minecraft/World.cpp:180–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180bool putLevelDatDataToFS(const QFileInfo& file, QByteArray& data)
181{
182 auto fullFilePath = getLevelDatFromFS(file);
183 if (fullFilePath.isNull()) {
184 return false;
185 }
186 PSaveFile f(fullFilePath);
187 if (!f.open(QIODevice::WriteOnly)) {
188 return false;
189 }
190 QByteArray compressed;
191 if (!GZip::zip(data, compressed)) {
192 return false;
193 }
194 if (f.write(compressed) != compressed.size()) {
195 f.cancelWriting();
196 return false;
197 }
198 return f.commit();
199}
200
201int64_t calculateWorldSize(const QFileInfo& file)
202{

Callers 1

renameMethod · 0.85

Calls 4

getLevelDatFromFSFunction · 0.85
openMethod · 0.80
writeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected