Skip to main content

Module storage

Module storage 

Source
Expand description

The game’s Storage on the Playdate’s files: <key>.ron per key in the game’s data folder (Disk/Data/<bundle id>/ in the Simulator), kept as shuyi-app’s FileStorage keeps them (ticket 3045).

A write puts the new value in <key>.ron.tmp and flushes it, copies the old <key>.ron (when it is a good copy: not empty, not all zero bytes, UTF-8) to <key>.ron.bak and flushes that, then renames the .tmp onto the .ron. A read of a .ron that is missing, empty, all zero bytes or not UTF-8 beside a good .bak reads the .bak. Where the SDK won’t move a file onto another, the old .ron goes first: its .bak holds it meanwhile.

Structs§

SdkStorage
A Storage of one file per key in the game’s data folder.

Constants§

CHECK_FOLDER
The folder of the data folder check runs in, away from the game’s own keys.

Functions§

check
Runs the engine’s storage conformance suite on sdk’s files, in CHECK_FOLDER, and leaves the folder empty; panics if it fails. A debug build on the device runs it at start, on the real files.