Skip to main content

Module assets

Module assets 

Source
Expand description

Asset access. Everything reads through Assets, so the editor (loose files) and a shipped game (single .pak) share the exact same loading code.

Structs§

PakData
Validated in-memory archive shared by cheap Assets::Pak clones. Construct through Assets::open_pak or Assets::from_pak_bytes.

Enums§

Assets
Unified asset source with root-relative, forward-slash paths.

Constants§

DEFAULT_VOLUME_BYTES
Default upper size of one data volume (a single file larger than this gets a volume of its own).

Functions§

normalize_path
Normalizes separators and ./.. segments in an asset-relative path. Rejects empty/root paths, absolute paths, drive prefixes, NUL and traversal above the root. The result uses forward slashes on every platform.
pack
Packs every file under src, plus extra in-memory files, into one archive. Returns the number of files. Extra files override loose files with the same normalized name; repeated extra names use the last value. Entries are sorted for reproducible builds. The output archive itself is excluded when located inside src.
pack_with
Like pack, with an explicit maximum volume size. Returns (files, volumes).