fix(server/game): write saves through a temp file

This commit is contained in:
capyb2222 committed 2026-09-12 20:30:27 -07:00
1 parent c16c95db94
commit cc7ec21ab9
2 files changed
+37 -8

No files matched your search

+10
View File
@@ -311,6 +311,15 @@ void testLogFormat() {
"the banner names its rows");
}
void testSafeWrite() {
const std::string path = "build/test-safe-write.json";
check(util::writeFile(path, "first"), "a file writes");
check(util::writeFile(path, "second, and longer"), "and overwrites");
bool ok = false;
check(util::readFile(path, &ok) == "second, and longer" && ok, "with the new content whole");
check(!util::fileExists(path + ".tmp"), "leaving no temp file behind");
}
} // namespace
int main() {
@@ -324,6 +333,7 @@ int main() {
testLineupCmdIds();
testIdleTimeout();
testLogFormat();
testSafeWrite();
testFillPresence();
testLargeMessage();
testAgainstProtoc();