Cauldron2D.Paths (Cauldron2D v0.1.3)

Copy Markdown View Source

Where a game keeps its files: one directory per game under each of the XDG base directories.

Cauldron2D.Paths.config(:my_game, "alice.settings")
#=> "~/.config/my_game/alice.settings"
Cauldron2D.Paths.data(:my_game, ["saves", "one.save"])
Cauldron2D.Paths.cache(:my_game)

$XDG_CONFIG_HOME, $XDG_DATA_HOME and $XDG_CACHE_HOME are honoured; without them the directories are ~/.config, ~/.local/share and ~/.cache. Nothing here creates a directory.

Summary

Functions

A path under the game's cache directory.

A path under the game's configuration directory.

A path under the game's data directory.

Types

game()

@type game() :: atom() | String.t()

parts()

@type parts() :: Path.t() | [Path.t()]

Functions

cache(game, parts \\ [])

@spec cache(game(), parts()) :: Path.t()

A path under the game's cache directory.

config(game, parts \\ [])

@spec config(game(), parts()) :: Path.t()

A path under the game's configuration directory.

data(game, parts \\ [])

@spec data(game(), parts()) :: Path.t()

A path under the game's data directory.