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

Function write

launcher/FileSystem.cpp:108–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void write(const QString& filename, const QByteArray& data)
109{
110 ensureExists(QFileInfo(filename).dir());
111 QSaveFile file(filename);
112 if (!file.open(QSaveFile::WriteOnly)) {
113 throw FileSystemException("Couldn't open " + filename + " for writing: " + file.errorString());
114 }
115 if (data.size() != file.write(data)) {
116 throw FileSystemException("Error writing data to " + filename + ": " + file.errorString());
117 }
118 if (!file.commit()) {
119 throw FileSystemException("Error while committing data to " + filename + ": " + file.errorString());
120 }
121}
122
123QByteArray read(const QString& filename)
124{

Callers

nothing calls this directly

Calls 6

ensureExistsFunction · 0.85
FileSystemExceptionClass · 0.85
dirMethod · 0.80
openMethod · 0.80
sizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected