aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Coutts <duncan.coutts@worc.ox.ac.uk>2006-01-19 20:28:27 +0000
committerDuncan Coutts <duncan.coutts@worc.ox.ac.uk>2006-01-19 20:28:27 +0000
commitf52324bb86a403f41ad9fc2050bc350fd7635714 (patch)
tree7d81a3ab8df7a5f27c2020fb2a840977478f4fa1
parent17adfda903a5bf9051159beb61cb37dc084eb8b4 (diff)
Rewrite pathJoin to only add a path separator when necessary.
When the path ends in a file seperator there is no need to add another. Now using "--wiki=http://blah.com/foo/" should do the right thing. (Code snippet adapted from Isaac's FilePath package.)
-rw-r--r--src/HaddockUtil.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index 96dc7a0b..0c458049 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -403,10 +403,13 @@ subIndexHtmlFile a = "doc-index-" ++ b ++ ".html"
| otherwise = show (ord a)
pathJoin :: [FilePath] -> FilePath
-pathJoin = concat . intersperse pathSeparatorStr
-
-pathSeparatorStr :: String
-pathSeparatorStr = [pathSeparator]
+pathJoin = foldr join []
+ where join :: FilePath -> FilePath -> FilePath
+ join path1 "" = path1
+ join "" path2 = path2
+ join path1 path2
+ | isPathSeparator (last path1) = path1++path2
+ | otherwise = path1++pathSeparator:path2
-- -----------------------------------------------------------------------------
-- Files we need to copy from our $libdir