]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Storage/DefaultPage.hs
Fixing build breakage...
[Rakka.git] / Rakka / Storage / DefaultPage.hs
index c8efd4c800a0a09f3bb9887ba2df82c88614715c..a6fbc10ddea89e3eeabba86d55c2532a82897e3c 100644 (file)
@@ -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