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

Function putLevelDatDataToFS

launcher/minecraft/World.cpp:165–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165bool putLevelDatDataToFS(const QFileInfo &file, QByteArray & data)
166{
167 auto fullFilePath = getLevelDatFromFS(file);
168 if(fullFilePath.isNull())
169 {
170 return false;
171 }
172 QSaveFile f(fullFilePath);
173 if(!f.open(QIODevice::WriteOnly))
174 {
175 return false;
176 }
177 QByteArray compressed;
178 if(!GZip::zip(data, compressed))
179 {
180 return false;
181 }
182 if(f.write(compressed) != compressed.size())
183 {
184 f.cancelWriting();
185 return false;
186 }
187 return f.commit();
188}
189
190World::World(const QFileInfo &file)
191{

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