Skip to main content

Module source

Module source 

Source
Expand description

Finding an authored source asset on disk.

A source string in world.jsonl may be a bare filename (a texture, HDRI, .cube LUT, or shader named without a directory), which resolves against an assets/ directory by recursive search. Anything carrying a directory component is a path already and is used verbatim, so absolute and relative paths still work.

The directory to search is the caller’s: a build threads the root it was given, and the hot-reload watcher passes the running project’s. Nothing here reads a process-global anchor, so two builds may resolve against different trees in one process. The shipped runtime plays compiled blobs and never resolves a source file.

Functions§

find_in
Recursively search assets_dir for a file matching the given bare filename, returning the first match.
resolve_source_path
Resolve a source string into a filesystem path: bare filenames are searched for under assets_dir and fall back to sitting directly in it, so a miss still names the file the read error will report. With no assets dir the source is returned verbatim, which is again the path the read error names.