Module ggez::filesystem[][src]

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,
  • The resources.zip file in the same directory as the program executable,
  • The root folder of the game's "save" directory which is in a platform-dependent location, such as ~/.local/share/<gameid>/ on Linux. The gameid is the the string passed to Context::load_from_conf(); some platforms such as Windows also incorporate the author string into the path.

Files will be searched for in these locations in order, and the first one 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.

See the source of the files example for more details.

Note that the file lookups WILL follow symlinks! It is more for convenience than absolute security, so don't treat it as being secure.

If you build ggez with the cargo-resource-root feature flag, it will also look for a resources/ subdirectory in the same directory as your Cargo.toml, which can be very convenient for development.

Structs

Filesystem

A structure that contains the filesystem state and cache.

OpenOptions

Options for opening files

Enums

File

Represents a file, either in the filesystem, or in the resources zip file, or whatever.