summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrijo <unknown>2005-01-24 15:41:16 +0000
committerkrijo <unknown>2005-01-24 15:41:16 +0000
commit37db5016a8b3f80e4d3b27378bbf6cfcd5a281e2 (patch)
tree995374f234cce0732fb0ca89d790f146d1de64d3
parentd9112080460280eccdabf328877ce04fbcc3ca4a (diff)
Handling absolute paths in prefixPathName :: String -> FilePath -> FilePath
Handling absolute paths in prefixPathName :: String -> FilePath -> FilePath (absolute paths are simply never prefixed).
-rw-r--r--src/GF/Infra/UseIO.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs
index d06904297..b37e695bc 100644
--- a/src/GF/Infra/UseIO.hs
+++ b/src/GF/Infra/UseIO.hs
@@ -94,8 +94,11 @@ pFilePaths s = case span (/=':') s of
(f,_) -> [f]
prefixPathName :: String -> FilePath -> FilePath
-prefixPathName "" f = f
-prefixPathName p f = p ++ "/" ++ f
+prefixPathName p f = case f of
+ '/':_ -> f -- do not prefix [Unix style] absolute paths
+ _ -> case p of
+ "" -> f
+ _ -> p ++ "/" ++ f
justInitPath :: FilePath -> FilePath
justInitPath = reverse . drop 1 . dropWhile (/='/') . reverse