| 37 | } |
| 38 | |
| 39 | void 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 | |
| 60 | QByteArray read(const QString &filename) |
| 61 | { |
nothing calls this directly
no test coverage detected