Safe Haskell | None |
---|
Personal game configuration file support.
- data CP
- mkConfig :: String -> IO CP
- appDataDir :: IO FilePath
- getOption :: Get_C a => CP -> SectionSpec -> OptionSpec -> Maybe a
- get :: Get_C a => CP -> SectionSpec -> OptionSpec -> a
- getItems :: CP -> SectionSpec -> [(String, String)]
- getFile :: CP -> SectionSpec -> OptionSpec -> IO FilePath
- dump :: FilePath -> CP -> IO ()
- getSetGen :: CP -> String -> IO (StdGen, CP)
Documentation
The content of the configuration file. It's parsed in a case sensitive way (unlike by default in ConfigFile).
mkConfig :: String -> IO CPSource
Read the player configuration file and use it to override any default config options. Currently we can't unset options, only override.
The default config, passed in argument configDefault
,
is expected to come from the default configuration file included via CPP
in file ConfigDefault.hs
.
appDataDir :: IO FilePathSource
Personal data directory for the game. Depends on the OS and the game,
e.g., for LambdaHack under Linux it's ~/.LambdaHack/
.
getOption :: Get_C a => CP -> SectionSpec -> OptionSpec -> Maybe aSource
A simplified access to an option in a given section, with simple error reporting (no internal errors are caught nor hidden). If there is no such option, gives Nothing.
get :: Get_C a => CP -> SectionSpec -> OptionSpec -> aSource
Simplified access to an option in a given section. Fails if the option is not present.
getItems :: CP -> SectionSpec -> [(String, String)]Source
An association list corresponding to a section. Fails if no such section.
getFile :: CP -> SectionSpec -> OptionSpec -> IO FilePathSource
Looks up a file path in the config file and makes it absolute. If the game's configuration directory exists, the file path is appended to it; otherwise, it's appended to the current directory.