summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-11 10:02:33 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-11 10:02:33 +0100
commit7a765f29a2f5dcf753e5418c96a9c40ddb9112be (patch)
tree8eaf3bd1156022177202e4037f5e54a6bc64dc71 /src
parenteb1fe136880e24836ef08746f2bd96258c35e3df (diff)
downloadhakyll-7a765f29a2f5dcf753e5418c96a9c40ddb9112be.tar.gz
Added $root in filepaths.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Hakyll/File.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs
index ec9d0fb..d8ee8db 100644
--- a/src/Text/Hakyll/File.hs
+++ b/src/Text/Hakyll/File.hs
@@ -16,13 +16,17 @@ module Text.Hakyll.File
import System.Directory
import System.FilePath
import Control.Monad
+import Data.List (isPrefixOf)
-- | Auxiliary function to remove pathSeparators form the start. We don't deal
--- with absolute paths here.
+-- with absolute paths here. We also remove $root from the start.
removeLeadingSeparator :: FilePath -> FilePath
removeLeadingSeparator [] = []
-removeLeadingSeparator p@(x:xs) | x `elem` pathSeparators = xs
- | otherwise = p
+removeLeadingSeparator path
+ | (head path') `elem` pathSeparators = (tail path')
+ | otherwise = path'
+ where path' = if "$root" `isPrefixOf` path then drop 5 path
+ else path
-- | Convert a relative filepath to a filepath in the destination (_site).
toDestination :: FilePath -> FilePath