-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Portable temporary file and directory support for Windows and Unix, based on code from Cabal
--   
--   The functions for creating temporary files and directories in the base
--   library are quite limited. The unixutils package contains some good
--   ones, but they aren't portable to Windows. This library just
--   repackages the Cabal implementations of its own temporary file and
--   folder functions so that you can use them without linking against
--   Cabal or depending on it being installed.
@package temporary
@version 1.2.0.4

module System.IO.Temp

-- | Create and use a temporary file in the system standard temporary
--   directory.
--   
--   Behaves exactly the same as <a>withTempFile</a>, except that the
--   parent temporary directory will be that returned by
--   <a>getTemporaryDirectory</a>.
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 <a>withTempDirectory</a>, except that the
--   parent temporary directory will be that returned by
--   <a>getTemporaryDirectory</a>.
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:
--   
--   <pre>
--   withTempFile "src" "sdist." $ \tmpFile hFile -&gt; do ...
--   </pre>
--   
--   The <tt>tmpFlie</tt> will be file in the given directory, e.g.
--   <tt>src/sdist.342</tt>.
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:
--   
--   <pre>
--   withTempDirectory "src" "sdist." $ \tmpDir -&gt; do ...
--   </pre>
--   
--   The <tt>tmpDir</tt> will be a new subdirectory of the given directory,
--   e.g. <tt>src/sdist.342</tt>.
withTempDirectory :: (MonadMask m, MonadIO m) => FilePath -> String -> (FilePath -> m a) -> m a

-- | 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 <tt>O_CREAT</tt> and <tt>O_EXCL</tt>
--   flags are used to prevent this attack, but note that <tt>O_EXCL</tt>
--   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 <a>openTempFile</a>, but opens the file in binary mode. See
--   <a>openBinaryFile</a> for more comments.
openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle)
openNewBinaryFile :: FilePath -> String -> IO (FilePath, Handle)
createTempDirectory :: FilePath -> String -> IO FilePath
