X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FStorage%2FDefaultPage.hs;h=a6fbc10ddea89e3eeabba86d55c2532a82897e3c;hb=88747f2463963ff2895a597b3054b12b2288530e;hp=c8efd4c800a0a09f3bb9887ba2df82c88614715c;hpb=b101c0a9aad609704eaa9157fe809be80d2aacf7;p=Rakka.git diff --git a/Rakka/Storage/DefaultPage.hs b/Rakka/Storage/DefaultPage.hs index c8efd4c..a6fbc10 100644 --- a/Rakka/Storage/DefaultPage.hs +++ b/Rakka/Storage/DefaultPage.hs @@ -4,7 +4,6 @@ module Rakka.Storage.DefaultPage , loadDefaultPage ) where - import Control.Arrow import Control.Arrow.ArrowIO import Control.Arrow.ArrowList @@ -18,7 +17,6 @@ import System.FilePath import System.FilePath.Find hiding (fileName, modificationTime) import System.Posix.Files import Text.XML.HXT.Arrow.ReadDocument -import Text.XML.HXT.Arrow.XmlIOStateArrow import Text.XML.HXT.DOM.XmlKeywords @@ -56,13 +54,18 @@ getDefaultDirContents dir getDir' =<< getDataFileName "defaultPages" where getDir' :: FilePath -> IO (Set PageName) - getDir' dirPath - = getDirectoryContents (dirPath encodePageName dir) - >>= - return . S.fromList . map (m dirPath) . filter f + getDir' basePath + = do let childDirPath = basePath encodePageName dir + exists <- doesDirectoryExist childDirPath + if exists then + getDirectoryContents childDirPath + >>= + return . S.fromList . map (m basePath) . filter f + else + return S.empty m :: FilePath -> FilePath -> PageName - m dirPath = (dir ) . decodePageName . makeRelative dirPath . dropExtension + m basePath = (dir ) . decodePageName . makeRelative basePath . dropExtension f :: FilePath -> Bool f "." = False