MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / savWrite

Method savWrite

switch/source/script/scripthost.cpp:216–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214 }
215
216 int savWrite(int handle, const char* path, const void* data, size_t size) override
217 {
218 // Create/replace: drop any existing file first so a shrinking write
219 // can't leave the old tail behind (fsdev truncates on "wb", but be
220 // explicit and symmetric with the 3DS adapter).
221 const std::string p = devPath(handle, path);
222 remove(p.c_str());
223
224 FILE* f = fopen(p.c_str(), "wb");
225 if (!f) {
226 return -1;
227 }
228
229 const size_t written = size > 0 ? fwrite(data, 1, size, f) : 0;
230 fclose(f);
231 return written == size ? 0 : -3;
232 }
233
234 int savDelete(int handle, const char* path) override { return remove(devPath(handle, path).c_str()) == 0 ? 0 : -1; }
235

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected