| 176 | } |
| 177 | |
| 178 | void write(const QString& filename, const QByteArray& data) |
| 179 | { |
| 180 | ensureExists(QFileInfo(filename).dir()); |
| 181 | PSaveFile file(filename); |
| 182 | if (!file.open(PSaveFile::WriteOnly)) { |
| 183 | throw FileSystemException("Couldn't open " + filename + " for writing: " + file.errorString()); |
| 184 | } |
| 185 | if (data.size() != file.write(data)) { |
| 186 | throw FileSystemException("Error writing data to " + filename + ": " + file.errorString()); |
| 187 | } |
| 188 | if (!file.commit()) { |
| 189 | throw FileSystemException("Error while committing data to " + filename + ": " + file.errorString()); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | void appendSafe(const QString& filename, const QByteArray& data) |
| 194 | { |
nothing calls this directly
no test coverage detected