A cross-platform interface to the filesystem.
This module provides access to files in specific places:
resources/subdirectory in the same directory as the program executable, if any,
resources.zipfile in the same directory as the program executable, if any,
- The root folder of the game’s “save” directory which is in a
~/.local/share/<gameid>/on Linux. The
gameidis the the string passed to
ContextBuilder::new(). Some platforms such as Windows also incorporate the
authorstring into the path.
These locations will be searched for files in the order listed, and the first file
found used. That allows game assets to be easily distributed as an archive
file, but locally overridden for testing or modding simply by putting
altered copies of them in the game’s
resources/ directory. It
is loosely based off of the
See the source of the
files example for more details.
Note that the file lookups WILL follow symlinks! This module’s directory isolation is intended for convenience, not security, so don’t assume it will be secure.
logcrate. Useful for debugging.
Filein read-only mode.
filesystem::OpenOptions. Note that even if you open a file read-only, it can only access files in the user directory.
/conf.tomlin any resource directory and loads it if it finds it. If it can’t read it for some reason, returns an error.
Confobject and saves it to the user directory, overwriting any file already there.