aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Tags.hs2
-rw-r--r--Utils.hs12
-rw-r--r--reploy.hs2
3 files changed, 13 insertions, 3 deletions
diff --git a/Tags.hs b/Tags.hs
index f7132d6..a9a4b5b 100644
--- a/Tags.hs
+++ b/Tags.hs
@@ -14,7 +14,7 @@ import qualified Data.Yaml as Y
import Lens.Micro
import Lens.Micro.Aeson
import Lens.Micro.Mtl
-import System.FilePath ((</>), joinPath, splitDirectories, takeFileName)
+import System.FilePath (joinPath, splitDirectories, takeFileName)
import AesonUtils
import Types
diff --git a/Utils.hs b/Utils.hs
index fa1bc09..1f39694 100644
--- a/Utils.hs
+++ b/Utils.hs
@@ -28,7 +28,7 @@ import System.Directory
, doesDirectoryExist
, getDirectoryContents
)
-import System.FilePath ((</>), splitDirectories, takeDirectory)
+import System.FilePath (splitDirectories, takeDirectory)
import Text.Pandoc.Definition
import qualified Text.Pandoc.Walk
import Types
@@ -96,6 +96,16 @@ unAbsolute = dropWhile (== '/')
withPandocBlocks :: ([Block] -> [Block]) -> Pandoc -> Pandoc
withPandocBlocks f (Pandoc meta blocks) = Pandoc meta (f blocks)
+infixr 5 </>
+
+a </> b@('/':_) =
+ error
+ $ "internal error: unchecked concatenation of absolute path: "
+ ++ a
+ ++ " </> "
+ ++ b
+a </> b = (System.FilePath.</>) a b
+
-- | Get all contents of a directory. (Interned from Hakyll.)
getRecursiveContents ::
(FilePath -> IO Bool) -- ^ Ignore this file/directory
diff --git a/reploy.hs b/reploy.hs
index 78574d4..b748e08 100644
--- a/reploy.hs
+++ b/reploy.hs
@@ -306,7 +306,7 @@ installRedirect target' from = do
target <- rootedPageLink target'
tname <- use redirectTemplate
templ <- use $ templates . to (M.! fromString tname)
- file <- indexFilename from
+ file <- indexFilename (unAbsolute from)
checkTarget file
io $ do
putStrLn $ "@ -> " ++ file ++ " -> " ++ target