| 106 | } |
| 107 | |
| 108 | void 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 | |
| 123 | QByteArray read(const QString& filename) |
| 124 | { |
nothing calls this directly
no test coverage detected