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

Function serializeServerDat

launcher/ui/pages/instance/ServersPage.cpp:155–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155static bool serializeServerDat(const QString& filename, nbt::tag_compound * levelInfo)
156{
157 try
158 {
159 if(!FS::ensureFilePathExists(filename))
160 {
161 return false;
162 }
163 std::ostringstream s;
164 nbt::io::write_tag("", *levelInfo, s);
165 QByteArray val(s.str().data(), (int) s.str().size() );
166 FS::write(filename, val);
167 return true;
168 }
169 catch (...)
170 {
171 return false;
172 }
173}
174
175class ServersModel: public QAbstractListModel
176{

Callers 1

save_internalMethod · 0.85

Calls 4

ensureFilePathExistsFunction · 0.85
writeFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected