| 200 | } |
| 201 | |
| 202 | int savWrite(int handle, const char* path, const void* data, size_t size) override |
| 203 | { |
| 204 | // Create/replace: the create-on-open path keeps an existing file's size, |
| 205 | // so drop it first (a missing file fails harmlessly). |
| 206 | const std::u16string p = archivePath(path); |
| 207 | FSUSER_DeleteFile(mSlots[handle].arch.fs(), fsMakePath(PATH_UTF16, p.data())); |
| 208 | |
| 209 | FSStream stream(mSlots[handle].arch.fs(), p, FS_OPEN_WRITE, (u32)size); |
| 210 | if (!stream.good()) { |
| 211 | const Result res = stream.result(); |
| 212 | stream.close(); |
| 213 | return (int)res; |
| 214 | } |
| 215 | |
| 216 | const u32 written = stream.write(data, (u32)size); |
| 217 | const Result res = stream.result(); |
| 218 | stream.close(); |
| 219 | return written == (u32)size ? 0 : (R_FAILED(res) ? (int)res : -3); |
| 220 | } |
| 221 | |
| 222 | int savDelete(int handle, const char* path) override |
| 223 | { |
no test coverage detected