Safe Haskell | None |
---|
Personal game configuration file support.
- data CP
- appDataDir :: IO FilePath
- mkConfig :: String -> FilePath -> IO CP
- get :: Get_C a => CP -> SectionSpec -> OptionSpec -> a
- getOption :: Get_C a => CP -> SectionSpec -> OptionSpec -> Maybe a
- set :: CP -> SectionSpec -> OptionSpec -> String -> CP
- getItems :: CP -> SectionSpec -> [(String, String)]
- to_string :: CP -> String
- dump :: Config -> FilePath -> IO ()
Documentation
The content of the configuration file. It's parsed in a case sensitive way (unlike by default in ConfigFile).
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/
.
mkConfig :: String -> FilePath -> IO CPSource
Read a player configuration file and use it to override
options from a default config. Currently we can't unset options,
only override. The default config, passed in argument configDefault
,
is expected to come from a default configuration file included via TH.
The player configuration comes from file cfile
.
get :: Get_C a => CP -> SectionSpec -> OptionSpec -> aSource
Simplified access to an option in a given section. Fails if the option is not present.
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.
set :: CP -> SectionSpec -> OptionSpec -> String -> CPSource
Simplified setting of an option in a given section. Overwriting forbidden.