- withLock :: String -> IO a -> IO a
- withLockCanFail :: String -> IO a -> IO (Either () a)
- withTemp :: (String -> IO a) -> IO a
- withOpenTemp :: ((Handle, String) -> IO a) -> IO a
- withStdoutTemp :: (String -> IO a) -> IO a
- withTempDir :: String -> (AbsolutePath -> IO a) -> IO a
- withPermDir :: String -> (AbsolutePath -> IO a) -> IO a
- withDelayedDir :: String -> (AbsolutePath -> IO a) -> IO a
- withNamedTemp :: String -> (String -> IO a) -> IO a
- writeToFile :: FilePathLike p => p -> (Handle -> IO ()) -> IO ()
- appendToFile :: FilePathLike p => p -> (Handle -> IO ()) -> IO ()
- writeBinFile :: FilePathLike p => p -> String -> IO ()
- writeLocaleFile :: FilePathLike p => p -> String -> IO ()
- writeDocBinFile :: FilePathLike p => p -> Doc -> IO ()
- appendBinFile :: FilePathLike p => p -> String -> IO ()
- appendDocBinFile :: FilePathLike p => p -> Doc -> IO ()
- readBinFile :: FilePathLike p => p -> IO String
- readLocaleFile :: FilePathLike p => p -> IO String
- readDocBinFile :: FilePathLike p => p -> IO Doc
- writeAtomicFilePS :: FilePathLike p => p -> ByteString -> IO ()
- gzWriteAtomicFilePS :: FilePathLike p => p -> ByteString -> IO ()
- gzWriteAtomicFilePSs :: FilePathLike p => p -> [ByteString] -> IO ()
- gzWriteDocFile :: FilePathLike p => p -> Doc -> IO ()
- rmRecursive :: FilePath -> IO ()
- removeFileMayNotExist :: FilePathLike p => p -> IO ()
- canonFilename :: FilePath -> IO FilePath
- maybeRelink :: String -> String -> IO Bool
- worldReadableTemp :: String -> IO String
- tempdirLoc :: IO FilePath
- editText :: String -> ByteString -> IO ByteString
- environmentHelpTmpdir :: ([String], [String])
- environmentHelpKeepTmpdir :: ([String], [String])
Documentation
withLockCanFail :: String -> IO a -> IO (Either () a)Source
Tries to perform some task if it can obtain the lock, Otherwise, just gives up without doing the task
withTemp :: (String -> IO a) -> IO aSource
withTemp
safely creates an empty file (not open for writing) and
returns its name.
The temp file operations are rather similar to the locking operations, in that they both should always try to clean up, so exitWith causes trouble.
withOpenTemp :: ((Handle, String) -> IO a) -> IO aSource
withOpenTemp
creates an already open temporary
file. Both of them run their argument and then delete the file. Also,
both of them (to my knowledge) are not susceptible to race conditions on
the temporary file (as long as you never delete the temporary file; that
would reintroduce a race condition).
withStdoutTemp :: (String -> IO a) -> IO aSource
withTempDir :: String -> (AbsolutePath -> IO a) -> IO aSource
withTempDir
creates an empty directory and then removes it when it
is no longer needed. withTempDir creates a temporary directory. The
location of that directory is determined by the contents of
_darcsprefstmpdir, if it exists, otherwise by $DARCS_TMPDIR
, and if
that doesn't exist then whatever your operating system considers to be a
a temporary directory (e.g. $TMPDIR
under Unix, $TEMP
under
Windows).
If none of those exist it creates the temporary directory
in the current directory, unless the current directory is under a _darcs
directory, in which case the temporary directory in the parent of the highest
_darcs directory to avoid accidentally corrupting darcs's internals.
This should not fail, but if it does indeed fail, we go ahead and use the
current directory anyway. If $DARCS_KEEP_TMPDIR
variable is set
temporary directory is not removed, this can be useful for debugging.
withPermDir :: String -> (AbsolutePath -> IO a) -> IO aSource
withPermDir
is like withTempDir
, except that it doesn't
delete the directory afterwards.
withDelayedDir :: String -> (AbsolutePath -> IO a) -> IO aSource
writeToFile :: FilePathLike p => p -> (Handle -> IO ()) -> IO ()Source
appendToFile :: FilePathLike p => p -> (Handle -> IO ()) -> IO ()Source
writeBinFile :: FilePathLike p => p -> String -> IO ()Source
writeLocaleFile :: FilePathLike p => p -> String -> IO ()Source
Writes a file. Differs from writeBinFile in that it writes the string encoded with the current locale instead of what GHC thinks is right.
writeDocBinFile :: FilePathLike p => p -> Doc -> IO ()Source
appendBinFile :: FilePathLike p => p -> String -> IO ()Source
appendDocBinFile :: FilePathLike p => p -> Doc -> IO ()Source
readBinFile :: FilePathLike p => p -> IO StringSource
readLocaleFile :: FilePathLike p => p -> IO StringSource
Reads a file. Differs from readBinFile in that it interprets the file in the current locale instead of as ISO-8859-1.
readDocBinFile :: FilePathLike p => p -> IO DocSource
writeAtomicFilePS :: FilePathLike p => p -> ByteString -> IO ()Source
gzWriteAtomicFilePS :: FilePathLike p => p -> ByteString -> IO ()Source
gzWriteAtomicFilePSs :: FilePathLike p => p -> [ByteString] -> IO ()Source
gzWriteDocFile :: FilePathLike p => p -> Doc -> IO ()Source
rmRecursive :: FilePath -> IO ()Source
removeFileMayNotExist :: FilePathLike p => p -> IO ()Source
editText :: String -> ByteString -> IO ByteStringSource
environmentHelpTmpdir :: ([String], [String])Source
environmentHelpKeepTmpdir :: ([String], [String])Source