summaryrefslogtreecommitdiff
path: root/Utility.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-13 01:49:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-13 01:49:21 -0400
commit77d052af3c527b3ebe349329305d80c9c5a2bf36 (patch)
treec4024eccefa7aa457a5f3d0cc737b68507a88efc /Utility.hs
parent4ecebfb218e58fb85a8e4484af93b5178a8046e7 (diff)
fix parentDir to work for relative too
Diffstat (limited to 'Utility.hs')
-rw-r--r--Utility.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Utility.hs b/Utility.hs
index dea53967f..349dd9355 100644
--- a/Utility.hs
+++ b/Utility.hs
@@ -34,7 +34,8 @@ hGetContentsStrict h = hGetContents h >>= \s -> length s `seq` return s
parentDir :: String -> String
parentDir dir =
if length dirs > 0
- then "/" ++ (join "/" $ take ((length dirs) - 1) dirs)
+ then absolute ++ (join "/" $ take ((length dirs) - 1) dirs)
else ""
where
dirs = filter (\x -> length x > 0) $ split "/" dir
+ absolute = if ((dir !! 0) == '/') then "/" else ""