]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
Bugfix
authorpho <pho@cielonegro.org>
Sat, 15 Mar 2008 06:48:21 +0000 (15:48 +0900)
committerpho <pho@cielonegro.org>
Sat, 15 Mar 2008 06:48:21 +0000 (15:48 +0900)
darcs-hash:20080315064821-62b54-56988553ccaee16fc3a4179324dcf26b606f4250.gz

Rakka/Storage/DefaultPage.hs

index c8efd4c800a0a09f3bb9887ba2df82c88614715c..e6f51a55a284dbc8737b3274a00a5acf4501c08f 100644 (file)
@@ -56,13 +56,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