+ -- If ./defaultPages exists, find pages in it. Otherwise find
+ -- defaultPages using Cabal's Paths_Rakka.
+ = do localDirExists ← doesLocalDirExist
+ if localDirExists then
+ findAllIn "defaultPages"
+ else
+ -- FIXME: This usage of getDataFileName is undocumented.
+ findAllIn =≪ getDataFileName "defaultPages"
+ where
+ findAllIn ∷ FilePath → IO (Set PageName)
+ findAllIn dirPath
+ = (S.fromList ∘ (decodePageName ∘ makeRelative dirPath ∘ dropExtension <$>))
+ <$>
+ find always (fileType ==? RegularFile) dirPath
+
+getDefaultDirContents :: PageName -> IO (Set PageName)
+getDefaultDirContents dir