diff options
author | Ian Lynagh <igloo@earth.li> | 2008-01-16 15:43:17 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-01-16 15:43:17 +0000 |
commit | c9b6b5e89b9f75bc40a9964fdd154242dd4ed45b (patch) | |
tree | ebe4bc5c60932136888b47bd7d650268c11043d0 /compiler/utils/Util.lhs | |
parent | 047864943968324c12c9252c69f32672bec241cb (diff) | |
download | haskell-c9b6b5e89b9f75bc40a9964fdd154242dd4ed45b.tar.gz |
Fix slash direction on Windows with the new filePath code
Diffstat (limited to 'compiler/utils/Util.lhs')
-rw-r--r-- | compiler/utils/Util.lhs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 90e7042bae..b967917753 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -70,6 +70,7 @@ module Util ( splitLongestPrefix, escapeSpaces, parseSearchPath, + Direction(..), reslash, ) where -- XXX This define is a bit of a hack, and should be done more nicely @@ -841,4 +842,17 @@ searchPathSeparator = ';' #else searchPathSeparator = ':' #endif + +data Direction = Forwards | Backwards + +reslash :: Direction -> FilePath -> FilePath +reslash d = f + where f ('/' : xs) = slash : f xs + f ('\\' : xs) = slash : f xs + f (x : xs) = x : f xs + f "" = "" + slash = case d of + Forwards -> '/' + Backwards -> '\\' \end{code} + |