aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockUtil.hs
diff options
context:
space:
mode:
authorpanne <unknown>2004-08-02 21:12:27 +0000
committerpanne <unknown>2004-08-02 21:12:27 +0000
commit13847171a3b1733b876bff8e157f8c97c665d1a6 (patch)
tree3e8aa3774feaf2aec1fb87bb22e9a1e69ee2d708 /src/HaddockUtil.hs
parent37830bff36b9344c11694d642bca9789f435dede (diff)
[haddock @ 2004-08-02 21:12:25 by panne]
Use pathJoin instead of low-level list-based manipulation for FilePaths
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r--src/HaddockUtil.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index f7dab157..f081a5fb 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -14,9 +14,8 @@ module HaddockUtil (
-- * Filename utilities
basename, dirname, splitFilename3,
- isPathSeparator, pathSeparator,
moduleHtmlFile, nameHtmlRef,
- contentsHtmlFile, indexHtmlFile, subIndexHtmlFile,
+ contentsHtmlFile, indexHtmlFile, subIndexHtmlFile, pathJoin,
cssFile, iconFile, jsFile, plusFile, minusFile,
-- * Miscellaneous utilities
@@ -28,7 +27,7 @@ module HaddockUtil (
import HsSyn
-import List ( intersect, isSuffixOf )
+import List ( intersect, isSuffixOf, intersperse )
import Maybe
import IO ( hPutStr, stderr )
import System
@@ -276,7 +275,7 @@ moduleHtmlFile :: String -> FilePath
moduleHtmlFile mdl =
case lookupFM html_xrefs (Module mdl) of
Nothing -> mdl ++ ".html"
- Just fp0 -> fp0 ++ pathSeparator : mdl ++ ".html"
+ Just fp0 -> pathJoin [fp0, mdl ++ ".html"]
nameHtmlRef :: String -> HsName -> String
nameHtmlRef mdl str = moduleHtmlFile mdl ++ '#':escapeStr (hsAnchorNameStr str)
@@ -290,6 +289,12 @@ subIndexHtmlFile a = "doc-index-" ++ b ++ ".html"
where b | isAlpha a = [a]
| otherwise = show (ord a)
+pathJoin :: [FilePath] -> FilePath
+pathJoin = concat . intersperse pathSeparatorStr
+
+pathSeparatorStr :: String
+pathSeparatorStr = [pathSeparator]
+
-- -----------------------------------------------------------------------------
-- Files we need to copy from our $libdir