diff options
author | Joey Hess <joey@kitenet.net> | 2013-05-12 19:19:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-05-12 19:19:28 -0400 |
commit | 1dd4574909b40ffdb77ae1338b353156d73983af (patch) | |
tree | 21a2d65e054964e91ba7376fcbca95b33f7f4472 /Utility | |
parent | b8558b724b302a9db16e9b75ac2cba425ecdc5c1 (diff) |
rename module
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Directory.hs | 2 | ||||
-rw-r--r-- | Utility/Tmp.hs (renamed from Utility/TempFile.hs) | 24 | ||||
-rw-r--r-- | Utility/WebApp.hs | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 599d41a03..9477ad5b9 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -18,7 +18,7 @@ import Control.Applicative import System.IO.Unsafe (unsafeInterleaveIO) import Utility.SafeCommand -import Utility.TempFile +import Utility.Tmp import Utility.Exception import Utility.Monad diff --git a/Utility/TempFile.hs b/Utility/Tmp.hs index 58d07c3a2..f03e4c0dc 100644 --- a/Utility/TempFile.hs +++ b/Utility/Tmp.hs @@ -1,11 +1,11 @@ -{- temp file functions +{- Temporary files and directories. - - Copyright 2010-2013 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} -module Utility.TempFile where +module Utility.Tmp where import Control.Exception (bracket) import System.IO @@ -31,15 +31,15 @@ viaTmp a file content = do {- Runs an action with a tmp file located in the system's tmp directory - (or in "." if there is none) then removes the file. -} -withTempFile :: Template -> (FilePath -> Handle -> IO a) -> IO a -withTempFile template a = do +withTmpFile :: Template -> (FilePath -> Handle -> IO a) -> IO a +withTmpFile template a = do tmpdir <- catchDefaultIO "." getTemporaryDirectory - withTempFileIn tmpdir template a + withTmpFileIn tmpdir template a {- Runs an action with a tmp file located in the specified directory, - then removes the file. -} -withTempFileIn :: FilePath -> Template -> (FilePath -> Handle -> IO a) -> IO a -withTempFileIn tmpdir template a = bracket create remove use +withTmpFileIn :: FilePath -> Template -> (FilePath -> Handle -> IO a) -> IO a +withTmpFileIn tmpdir template a = bracket create remove use where create = openTempFile tmpdir template remove (name, handle) = do @@ -50,15 +50,15 @@ withTempFileIn tmpdir template a = bracket create remove use {- Runs an action with a tmp directory located within the system's tmp - directory (or within "." if there is none), then removes the tmp - directory and all its contents. -} -withTempDir :: Template -> (FilePath -> IO a) -> IO a -withTempDir template a = do +withTmpDir :: Template -> (FilePath -> IO a) -> IO a +withTmpDir template a = do tmpdir <- catchDefaultIO "." getTemporaryDirectory - withTempDirIn tmpdir template a + withTmpDirIn tmpdir template a {- Runs an action with a tmp directory located within a specified directory, - then removes the tmp directory and all its contents. -} -withTempDirIn :: FilePath -> Template -> (FilePath -> IO a) -> IO a -withTempDirIn tmpdir template = bracket create remove +withTmpDirIn :: FilePath -> Template -> (FilePath -> IO a) -> IO a +withTmpDirIn tmpdir template = bracket create remove where remove d = whenM (doesDirectoryExist d) $ removeDirectoryRecursive d diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 0614384a1..762819b2f 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -10,7 +10,7 @@ module Utility.WebApp where import Common -import Utility.TempFile +import Utility.Tmp import Utility.FileMode import qualified Yesod |