| 305 | } |
| 306 | |
| 307 | int savWrite(int handle, const char* path, const void* data, size_t size) override |
| 308 | { |
| 309 | // Create/replace: the create-on-open path keeps an existing file's size, |
| 310 | // so drop it first (a missing file fails harmlessly). |
| 311 | const std::u16string p = archivePath(path); |
| 312 | FSUSER_DeleteFile(mSlots[handle].arch.fs(), fsMakePath(PATH_UTF16, p.data())); |
| 313 | |
| 314 | FSStream stream(mSlots[handle].arch.fs(), p, FS_OPEN_WRITE, (u32)size); |
| 315 | if (!stream.good()) { |
| 316 | const Result res = stream.result(); |
| 317 | stream.close(); |
| 318 | return (int)res; |
| 319 | } |
| 320 | |
| 321 | const u32 written = stream.write(data, (u32)size); |
| 322 | const Result res = stream.result(); |
| 323 | stream.close(); |
| 324 | return written == (u32)size ? 0 : (R_FAILED(res) ? (int)res : -3); |
| 325 | } |
| 326 | |
| 327 | int savDelete(int handle, const char* path) override |
| 328 | { |
no test coverage detected