mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 10:19:57 -04:00
Write make_game.py's state.json whole or not at all.
A write cut by a full disk or by Cancel ending the build left a state.json that loads as {}: the launcher then took
the built game for none, showed the first run and needed the dump again for a rebuild. It is now written to a
temporary file and moved into place.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1108,8 +1108,12 @@ def main():
|
||||
state_lock = threading.Lock() # the RomFS step records itself from its own thread
|
||||
|
||||
def save():
|
||||
# whole or not at all: a cut write (a full disk, Cancel ending the process) would leave a state.json that
|
||||
# loads as {}, and the launcher would take the built game for none and ask for the dump again
|
||||
with state_lock:
|
||||
state_path.write_text(json.dumps(state, indent=1), encoding='utf-8')
|
||||
tmp = state_path.with_name(state_path.name + '.tmp')
|
||||
tmp.write_text(json.dumps(state, indent=1), encoding='utf-8')
|
||||
os.replace(tmp, state_path)
|
||||
|
||||
def run(name):
|
||||
t = time.time()
|
||||
|
||||
Reference in New Issue
Block a user