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

Function write

launcher/FileSystem.cpp:191–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191void write(const QString& filename, const QByteArray& data)
192{
193 ensureExists(QFileInfo(filename).dir());
194 PSaveFile file(filename);
195 if (!file.open(PSaveFile::WriteOnly)) {
196 throw FileSystemException("Couldn't open " + filename + " for writing: " + file.errorString());
197 }
198 if (data.size() != file.write(data)) {
199 throw FileSystemException("Error writing data to " + filename + ": " + file.errorString());
200 }
201 if (!file.commit()) {
202 throw FileSystemException("Error while committing data to " + filename + ": " + file.errorString());
203 }
204}
205
206void appendSafe(const QString& filename, const QByteArray& data)
207{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected