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

Function write

launcher/FileSystem.cpp:39–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void write(const QString &filename, const QByteArray &data)
40{
41 ensureExists(QFileInfo(filename).dir());
42 QSaveFile file(filename);
43 if (!file.open(QSaveFile::WriteOnly))
44 {
45 throw FileSystemException("Couldn't open " + filename + " for writing: " +
46 file.errorString());
47 }
48 if (data.size() != file.write(data))
49 {
50 throw FileSystemException("Error writing data to " + filename + ": " +
51 file.errorString());
52 }
53 if (!file.commit())
54 {
55 throw FileSystemException("Error while committing data to " + filename + ": " +
56 file.errorString());
57 }
58}
59
60QByteArray read(const QString &filename)
61{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected