diff options
Diffstat (limited to 'Logs/File.hs')
-rw-r--r-- | Logs/File.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Logs/File.hs b/Logs/File.hs new file mode 100644 index 000000000..c93b21e4d --- /dev/null +++ b/Logs/File.hs @@ -0,0 +1,24 @@ +{- git-annex log files + - + - Copyright 2018 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Logs.File where + +import Annex.Common +import Annex.Perms +import Utility.Tmp + +writeLogFile :: FilePath -> String -> Annex () +writeLogFile f c = go `catchNonAsync` \_e -> do + -- Most of the time, the directory will exist, so this is only + -- done if writing the file fails. + createAnnexDirectory (parentDir f) + go + where + go = viaTmp writelog f c + writelog f' c' = do + liftIO $ writeFile f' c' + setAnnexFilePerm f' |