Extra-1.29: A grab bag of modules.Source codeContentsIndex
Extra.Files
Description
Some extra operations on files. The functions here generally return (Right ()) on success, Left [messages] on failure, and throw an exception when a failure leaves things in an inconsistant state. An example of an inconsistant state would be if we got a failure when writing out a file, but were unable to restore the original file to its original position.
Synopsis
getSubDirectories :: FilePath -> IO [String]
renameAlways :: FilePath -> FilePath -> IO (Either [String] ())
renameMissing :: FilePath -> FilePath -> IO (Either [String] ())
deleteMaybe :: FilePath -> IO (Either [String] ())
installFiles :: [(FilePath, FilePath)] -> IO (Either [String] ())
writeAndZipFileWithBackup :: FilePath -> ByteString -> IO (Either [String] ())
writeAndZipFile :: FilePath -> ByteString -> IO (Either [String] ())
backupFile :: FilePath -> IO (Either [String] ())
writeFileIfMissing :: Bool -> FilePath -> String -> IO ()
maybeWriteFile :: FilePath -> String -> IO ()
createSymbolicLinkIfMissing :: String -> FilePath -> IO ()
prepareSymbolicLink :: FilePath -> FilePath -> IO ()
forceRemoveLink :: FilePath -> IO ()
replaceFile :: FilePath -> String -> IO ()
Documentation
getSubDirectories :: FilePath -> IO [String]Source
Return the list of subdirectories, omitting . and .. and ignoring symbolic links.
renameAlways :: FilePath -> FilePath -> IO (Either [String] ())Source
Change a file's name, removing any existing file with the new name.
renameMissing :: FilePath -> FilePath -> IO (Either [String] ())Source
Change a file's name only if the new name doesn't exist.
deleteMaybe :: FilePath -> IO (Either [String] ())Source
Delete a file if it exists
installFiles :: [(FilePath, FilePath)] -> IO (Either [String] ())Source
Atomically install a list of files. Returns a list of what went wrong on failure. Will throw an error if it fails and is unable to restore the original files to their original states.
writeAndZipFileWithBackup :: FilePath -> ByteString -> IO (Either [String] ())Source
Write out three versions of a file, regular, gzipped, and bzip2ed.
writeAndZipFile :: FilePath -> ByteString -> IO (Either [String] ())Source
Write out three versions of a file, regular, gzipped, and bzip2ed. This new version assumes the files are written to temporary locations, so any existing file there can be removed.
backupFile :: FilePath -> IO (Either [String] ())Source
writeFileIfMissing :: Bool -> FilePath -> String -> IO ()Source
Like writeFile, but if the file already exists don't touch it. Example: writeFileIfMissing True "/var/lib/dpkg/status" ""
maybeWriteFile :: FilePath -> String -> IO ()Source
Write a file if its content is different from the given text.
createSymbolicLinkIfMissing :: String -> FilePath -> IO ()Source
Add-on for System.Posix.Files
prepareSymbolicLink :: FilePath -> FilePath -> IO ()Source
forceRemoveLink :: FilePath -> IO ()Source
like removeLink, but does not fail if link did not exist
replaceFile :: FilePath -> String -> IO ()Source
Produced by Haddock version 2.6.0