-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Portable temporary file and directory support -- -- Functions for creating temporary files and directories. @package temporary @version 1.2.1 -- | Functions to create temporary files and directories. -- -- Most functions come in two flavours: those that create -- files/directories under the system standard temporary directory and -- those that use the user-supplied directory. -- -- The functions that create files/directories under the system standard -- temporary directory will return canonical absolute paths (see -- getCanonicalTemporaryDirectory). The functions use the -- user-supplied directory do not canonicalize the returned path. -- -- The action inside withTempFile or withTempDirectory is -- allowed to remove the temporary file/directory if it needs to. module System.IO.Temp -- | Create and use a temporary file in the system standard temporary -- directory. -- -- Behaves exactly the same as withTempFile, except that the -- parent temporary directory will be that returned by -- getCanonicalTemporaryDirectory. withSystemTempFile :: (MonadIO m, MonadMask m) => String -> (FilePath -> Handle -> m a) -> m a -- | Create and use a temporary directory in the system standard temporary -- directory. -- -- Behaves exactly the same as withTempDirectory, except that the -- parent temporary directory will be that returned by -- getCanonicalTemporaryDirectory. withSystemTempDirectory :: (MonadIO m, MonadMask m) => String -> (FilePath -> m a) -> m a -- | Use a temporary filename that doesn't already exist. -- -- Creates a new temporary file inside the given directory, making use of -- the template. The temp file is deleted after use. For example: -- --
--   withTempFile "src" "sdist." $ \tmpFile hFile -> do ...
--   
-- -- The tmpFile will be file in the given directory, e.g. -- src/sdist.342. withTempFile :: (MonadIO m, MonadMask m) => FilePath -> String -> (FilePath -> Handle -> m a) -> m a -- | Create and use a temporary directory. -- -- Creates a new temporary directory inside the given directory, making -- use of the template. The temp directory is deleted after use. For -- example: -- --
--   withTempDirectory "src" "sdist." $ \tmpDir -> do ...
--   
-- -- The tmpDir will be a new subdirectory of the given directory, -- e.g. src/sdist.342. withTempDirectory :: (MonadMask m, MonadIO m) => FilePath -> String -> (FilePath -> m a) -> m a -- | Like openBinaryTempFile, but uses 666 rather than 600 for the -- permissions. -- -- Equivalent to openBinaryTempFileWithDefaultPermissions. openNewBinaryFile :: FilePath -> String -> IO (FilePath, Handle) -- | Create a temporary directory. See withTempDirectory. createTempDirectory :: FilePath -> String -> IO FilePath -- | Create a unique new file, write (text mode) a given data string to it, -- and close the handle again. The file will not be deleted -- automatically, and only the current user will have permission to -- access the file (see openTempFile for details). writeTempFile :: FilePath -> String -> String -> IO FilePath -- | Like writeTempFile, but use the system directory for temporary -- files. writeSystemTempFile :: String -> String -> IO FilePath -- | Create a unique new empty file. (Equivalent to writeTempFile -- with empty data string.) This is useful if the actual content is -- provided by an external process. emptyTempFile :: FilePath -> String -> IO FilePath -- | Like emptyTempFile, but use the system directory for temporary -- files. emptySystemTempFile :: String -> IO FilePath -- | The function creates a temporary file in ReadWrite mode. The created -- file isn't deleted automatically, so you need to delete it manually. -- -- The file is creates with permissions such that only the current user -- can read/write it. -- -- With some exceptions (see below), the file will be created securely in -- the sense that an attacker should not be able to cause openTempFile to -- overwrite another file on the filesystem using your credentials, by -- putting symbolic links (on Unix) in the place where the temporary file -- is to be created. On Unix the O_CREAT and O_EXCL -- flags are used to prevent this attack, but note that O_EXCL -- is sometimes not supported on NFS filesystems, so if you rely on this -- behaviour it is best to use local filesystems only. openTempFile :: FilePath -> String -> IO (FilePath, Handle) -- | Like openTempFile, but opens the file in binary mode. See -- openBinaryFile for more comments. openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle) -- | Return the absolute and canonical path to the system temporary -- directory. -- --
--   >>> setCurrentDirectory "/home/feuerbach/"
--   
--   >>> setEnv "TMPDIR" "."
--   
--   >>> getTemporaryDirectory
--   "."
--   
--   >>> getCanonicalTemporaryDirectory
--   "/home/feuerbach"
--   
getCanonicalTemporaryDirectory :: IO FilePath