simvx.core.io¶
Filesystem I/O helpers shared across the engine.
Centralises crash-safe write patterns so the IDE, scene save, asset writer,
and other consumers share one implementation. The pickle-rotation flavour
lives in simvx.core.save_manager.pickle_atomic for the (game save +
editor autosave) payloads that need .bak/.bak2 chains.
Module Contents¶
Functions¶
Write |
API¶
- simvx.core.io.atomic_write_text(path: pathlib.Path | str, text: str, *, encoding: str = 'utf-8') pathlib.Path[source]¶
Write
texttopathatomically.Writes to
<path>.tmp, fsyncs, thenos.replace()onto the target so a crash mid-write never leaves a truncated file on disk – either the old file or the new one is fully present at every instant.Creates parent directories as needed. Raises
OSErroron write failure (the temp file is best-effort cleaned).