License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Various utilities related to loading game data files.
Synopsis
- data NameGenerator = NameGenerator {}
- getDataDirSafe :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => AssetData -> FilePath -> m FilePath
- getDataFileNameSafe :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => AssetData -> FilePath -> m FilePath
- dataNotFound :: FilePath -> IO LoadingFailure
- getSwarmXdgDataSubdir :: Bool -> FilePath -> IO FilePath
- getSwarmXdgDataFile :: Bool -> FilePath -> IO FilePath
- getSwarmSavePath :: Bool -> IO FilePath
- getSwarmHistoryPath :: Bool -> IO FilePath
- readAppData :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => m (Map Text Text)
- initNameGenerator :: Has (Throw SystemFailure) sig m => Map Text Text -> m NameGenerator
Documentation
data NameGenerator Source #
Read-only lists of adjectives and words for use in building random robot names
getDataDirSafe :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => AssetData -> FilePath -> m FilePath Source #
Get subdirectory from swarm data directory.
This will first look in Cabal generated path and then
try a data
directory in XdgData
path.
The idea is that when installing with Cabal/Stack the first is preferred, but when the players install a binary they need to extract the `data` archive to the XDG directory.
getDataFileNameSafe :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => AssetData -> FilePath -> m FilePath Source #
Get file from swarm data directory.
See the note in getDataDirSafe
.
dataNotFound :: FilePath -> IO LoadingFailure Source #
Get a nice message suggesting to download data
directory to XdgData
.
getSwarmXdgDataSubdir :: Bool -> FilePath -> IO FilePath Source #
Get path to swarm data, optionally creating necessary
directories. This could fail if user has bad permissions
on his own $HOME
or $XDG_DATA_HOME
which is unlikely.
getSwarmSavePath :: Bool -> IO FilePath Source #
Get path to swarm saves, optionally creating necessary directories.
getSwarmHistoryPath :: Bool -> IO FilePath Source #
Get path to swarm history, optionally creating necessary directories.
readAppData :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => m (Map Text Text) Source #
Read all the .txt
files in the data/
directory.
initNameGenerator :: Has (Throw SystemFailure) sig m => Map Text Text -> m NameGenerator Source #