Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- getFileStatus :: FilePath -> IO (Maybe FileStatus)
- doesDirectoryReallyExist :: FilePath -> IO Bool
- removeFileMayNotExist :: FilePathLike p => p -> IO ()
- getRecursiveContents :: FilePath -> IO [FilePath]
- getRecursiveContentsFullPath :: FilePath -> IO [FilePath]
- copyTree :: FilePath -> FilePath -> IO ()
- fetchFilePS :: String -> Cachable -> IO ByteString
- fetchFileLazyPS :: String -> Cachable -> IO ByteString
- gzFetchFilePS :: String -> Cachable -> IO ByteString
- speculateFileOrUrl :: String -> FilePath -> IO ()
- copyFileOrUrl :: String -> String -> FilePath -> Cachable -> IO ()
- data Cachable
- = Cachable
- | Uncachable
- | MaxAge !CInt
- backupByRenaming :: FilePath -> IO ()
- backupByCopying :: FilePath -> IO ()
- withTemp :: (FilePath -> IO a) -> IO a
- withOpenTemp :: ((Handle, FilePath) -> IO a) -> IO a
Files and directories
getFileStatus :: FilePath -> IO (Maybe FileStatus) Source #
Badly named, since it is actually getSymbolicLinkStatus
, with all
IOError
s turned into Nothing
.
doesDirectoryReallyExist :: FilePath -> IO Bool Source #
Whether a path is an existing directory, but not a symlink to one.
removeFileMayNotExist :: FilePathLike p => p -> IO () Source #
Variant of removeFile
that doesn't throw exception when file does not exist.
getRecursiveContents :: FilePath -> IO [FilePath] Source #
Return all files under given directory that aren't directories.
getRecursiveContentsFullPath :: FilePath -> IO [FilePath] Source #
Return all files under given directory that aren't directories.
Unlike getRecursiveContents
this function returns the full path.
copyTree :: FilePath -> FilePath -> IO () Source #
Recursively copy a directory, where the target directory is supposed to already exist.
Fetching files
fetchFilePS :: String -> Cachable -> IO ByteString Source #
fetchFilePS fileOrUrl cache
returns the content of its argument (either a
file or an URL). If it has to download an url, then it will use a cache as
required by its second argument.
We always use default remote darcs, since it is not fatal if the remote darcs does not exist or is too old -- anything that supports transfer-mode should do, and if not, we will fall back to SFTP or SCP.
fetchFileLazyPS :: String -> Cachable -> IO ByteString Source #
fetchFileLazyPS fileOrUrl cache
lazily reads the content of its argument
(either a file or an URL). Warning: this function may constitute a fd leak;
make sure to force consumption of file contents to avoid that. See
"fetchFilePS" for details.
gzFetchFilePS :: String -> Cachable -> IO ByteString Source #
Like fetchFilePS
but transparently handle gzip compressed files.
speculateFileOrUrl :: String -> FilePath -> IO () Source #
Initiate background file download for the given file path or URL to the given location.
:: String | remote darcs executable |
-> String | path representing the origin file or URL |
-> FilePath | destination path |
-> Cachable | tell whether file to copy is cachable |
-> IO () |
Very much darcs-specific copying procedure. For local files it tries to hard-link, falling back to normal copy if it fails. Remote URLs are downloaded using either HTTP or SSH. For SSH, this tries to use the given remote darcs command to invoke it's transfer-mode command.
Backup
backupByRenaming :: FilePath -> IO () Source #
backupByCopying :: FilePath -> IO () Source #