Expand description
Sanitary file I/O and cached-path resolution for the Optic engine.
All fallible functions return OpticResult wrapping OpticErrorKind::File
errors with descriptive messages.
§Cache path convention
Assets are cached alongside the source file in an optc/ subdirectory:
ⓘ
assets/tex/foo.png → assets/tex/optc/foo.otxtr
models/cube.obj → models/optc/cube.omesh
shaders/main.glsl → shaders/optc/main.oshdrFunctions§
- cached_
path - Compute the cache path for a source asset.
- create_
dir - Create a directory and all parent directories (like
mkdir -p). - exists
- Check whether a file or directory exists at the given path.
- extension
- Extract the file extension from a path.
- name
- Extract the file stem (name without extension) from a path.
- read_
bytes - Read a file as raw bytes.
- read_
string - Read a file as a UTF-8 string.
- write_
bytes - Write raw bytes to a file, creating parent directories if needed.
- write_
string - Write a UTF-8 string to a file, creating parent directories if needed.