Commit 6db437d5c906dda3f895e7cb084b1bba07143d3f Parent: 345cebf9b1c456f24ff85c4e6924008eac30730e Author: mcol <mcol@posteo.net> Date: 2022-04-06 20:33:22 +0100 Committer: mcol <mcol@posteo.net> Committed: 2022-04-06 20:33:22 +0100 Remove existing index file more clearly
src/Index.hs Modified
@@ -8,6 +8,8 @@ import qualified Data.HashMap.Strict as HashMap import Data.Text (Text, unpack) import Path (toFilePath) +import Path.IO (ignoringAbsence) +import System.Directory (removeFile) import System.FilePath (combine) import Text.Ginger.GVal (GVal, toGVal) import Text.Ginger.Html (Html, htmlSource) @@ -29,7 +31,7 @@ runIndexFile env repos template = do let output = combine (toFilePath . envOutput $ env) . toFilePath . templatePath $ template unless (envQuiet env) . putStrLn $ "Writing " <> output - writeFile output "" -- Clear contents of file if it exists + ignoringAbsence . removeFile $ output void $ easyRenderM (appendFile output . unpack . htmlSource)