Safe Haskell | None |
---|---|
Language | Haskell98 |
Working with the file system.
Documentation
Properties of the file system we can test for.
inDir :: FilePath -> Build a -> Build a Source
Run a command in a different working directory. Throws an error if the directory doesn't exist.
inScratchDir :: FilePath -> Build a -> Build a Source
Create a new directory with the given name, run a command within it, then change out and recursively delete the directory. Throws an error if a directory with the given name already exists.
clobberDir :: FilePath -> Build () Source
Delete a dir recursively if it's there, otherwise do nothing.
ensureDir :: FilePath -> Build () Source
Create a new directory if it isn't already there, or return successfully if it is.
withTempFile :: (FilePath -> Build a) -> Build a Source
Create a temp file, pass it to some command, then delete the file after the command finishes.
atomicWriteFile :: FilePath -> String -> Build () Source
Atomically write a file by first writing it to a tmp file then renaming it. This prevents concurrent processes from reading half-written files.