LambdaHack-0.5.0.0: A game engine library for roguelike dungeon crawlers

Safe HaskellSafe
LanguageHaskell2010

Game.LambdaHack.Common.File

Description

Saving/loading with serialization and compression.

Synopsis

Documentation

encodeEOF :: Binary a => FilePath -> a -> IO () Source #

Serialize, compress and save data with an EOF marker. The OK is used as an EOF marker to ensure any apparent problems with corrupted files are reported to the user ASAP.

strictDecodeEOF :: Binary a => FilePath -> IO a Source #

Read, decompress and deserialize data with an EOF marker. The OK EOF marker ensures any easily detectable file corruption is discovered and reported before the function returns.

tryCreateDir :: FilePath -> IO () Source #

Try to create a directory, if it doesn't exist. We catch exceptions in case many clients try to do the same thing at the same time.

tryCopyDataFiles :: FilePath -> (FilePath -> IO FilePath) -> [(FilePath, FilePath)] -> IO () Source #

Try to copy over data files, if not already there. We catch exceptions in case many clients try to do the same thing at the same time.

appDataDir :: IO FilePath Source #

Personal data directory for the game. Depends on the OS and the game, e.g., for LambdaHack under Linux it's ~/.LambdaHack/.