From 7a765f29a2f5dcf753e5418c96a9c40ddb9112be Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 11 Jan 2010 10:02:33 +0100 Subject: Added $root in filepaths. --- src/Text/Hakyll/File.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3