Expand description
A cross-platform interface to the filesystem.
This module provides access to files in specific places:
- The
resources/subdirectory in the same directory as the program executable, if any, - The
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
platform-dependent location,
such as
~/.local/share/<gameid>/on Linux. Thegameidis the the string passed toContextBuilder::new(). Some platforms such as Windows also incorporate theauthorstring 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 PhysicsFS library.
See the source of the files example for more details.
The names of resources/ and resources.zip can be changed with the methods
resources_dir_name
and
resources_zip_name
of ContextBuilder.
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.
Structs§
- File
- Represents a file, either in the filesystem, or in the resources zip file, or whatever.
- Filesystem
- A structure that contains the filesystem state and cache.
- Open
Options - Options for opening files