Choosing between per‑file copy and single‑archive backup for atomic LÖVE saves
0 reputation · 20 Nov 2023, 00:34 UTC
Backup goal
Ensure a reliable snapshot of the LÖVE save directory despite non‑deterministic enumeration order, possible file changes during enumeration, and a limited number of simultaneous file handles.
Constraints and uncertainty
Per‑file copying preserves individual file attributes and allows incremental updates but opens many handles and does not guarantee an atomic snapshot if the source changes while iterating. Packing all files into a single archive yields an atomic write and reduces handle usage, yet requires implementing or bundling an archive format and complicates restoration of individual files. The documentation notes that love.filesystem.enumerate may omit files created or deleted during the call, leaving developers to decide whether to accept possible inconsistency or to retry enumeration until a stable list is obtained.
Which approach better satisfies the need for atomicity while respecting handle limits, and how should the enumeration instability be mitigated?