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

Function putLevelDatDataToFS

launcher/minecraft/World.cpp:186–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186bool putLevelDatDataToFS(const QFileInfo &file, QByteArray & data)
187{
188 auto fullFilePath = getLevelDatFromFS(file);
189 if(fullFilePath.isNull())
190 {
191 return false;
192 }
193 QSaveFile f(fullFilePath);
194 if(!f.open(QIODevice::WriteOnly))
195 {
196 return false;
197 }
198 QByteArray compressed;
199 if(!GZip::zip(data, compressed))
200 {
201 return false;
202 }
203 if(f.write(compressed) != compressed.size())
204 {
205 f.cancelWriting();
206 return false;
207 }
208 return f.commit();
209}
210
211int64_t calculateWorldSize(const QFileInfo &file)
212{

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