| 189 | } |
| 190 | |
| 191 | void 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 | |
| 206 | void appendSafe(const QString& filename, const QByteArray& data) |
| 207 | { |
nothing calls this directly
no test coverage detected