lambdabot-core-5.3: Lambdabot core functionality

Safe HaskellNone
LanguageHaskell98

Lambdabot.File

Description

Manage lambdabot's state files. There are three relevant directories:

  • local: .State (configurable, see outputDir)
  • home: ~.lambdabotState/
  • data: relative to the data directory of the lambdabot package.

Files are stored locally if the directory exists; otherwise, in the home directory. When reading a state file, and the file exists in the data directory but nowhere else, then it is picked up from the data directory.

Synopsis

Documentation

stateDir :: LB FilePath Source #

Locate state directory. Returns the local directory if it exists, and the home directory otherwise.

findLBFileForReading :: FilePath -> LB (Maybe FilePath) Source #

Look for the file in the local, home, and data directories.

findLBFileForWriting :: FilePath -> LB FilePath Source #

Return file name for writing state. The file will reside in the state directory (stateDir), and findLBFileForWriting ensures that the state directory exists.

findOrCreateLBFile :: FilePath -> LB String Source #

This returns the same file name as findLBFileForWriting. If the file does not exist, it is either copied from the data (or home) directory, if a copy is found there; otherwise, an empty file is created instead.

findLBFile :: FilePath -> LB (Maybe String) Source #

Deprecated: Use findLBFileForReading or findLBFileForWriting instead

Try to find a pre-existing file, searching first in the local or home directory (but not in the data directory)