Skip to main content

read_folder

Function read_folder 

Source
pub fn read_folder(
    path: &Path,
    name: &str,
    max_file_bytes: u64,
) -> Result<Layer, FolderError>
Expand description

Every file in the folder at path and the folders below it, as one layer named name, each at its path relative to the folder, /-separated (data/crops.ron). A link to a file is read; a link to a folder is not followed. Read it once: the layer’s files are kept for the life of the program.

In a build with debug tools the folder is watched from then on: a file that changes takes its new bytes in the layer, and the game’s modules hear of it (Module::reloaded).

§Errors

A file over max_file_bytes, a file or folder that can’t be read or whose name isn’t UTF-8, each naming it, and a path the layer refuses.