diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-06 14:55:11 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-06 15:06:45 -0400 |
commit | 595e9a41cedbed40dfc6680d34ef6de5e3a2ff8e (patch) | |
tree | 5b8be7cf634f374a0b49d3838c3437c90ad4e503 /Utility/Path.hs | |
parent | ebb16a8c45f5ec12aff6fd158090d6a36d5590dc (diff) |
work around absNormPath not working on Windows
Seems I punted on this while porting before. This hack relies on DOS not
using / in filenames, it's effectively an alternate path separatr in at
least current versions of windows..
Diffstat (limited to 'Utility/Path.hs')
-rw-r--r-- | Utility/Path.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs index 44ac72f06..0b15e7421 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -21,10 +21,10 @@ import Control.Applicative import Data.Char import qualified System.FilePath.Posix as Posix #else -import qualified "MissingH" System.Path as MissingH import System.Posix.Files #endif +import qualified "MissingH" System.Path as MissingH import Utility.Monad import Utility.UserInfo @@ -34,15 +34,15 @@ import Utility.UserInfo - - On Unix, collapses and normalizes ".." etc in the path. May return Nothing - if the path cannot be normalized. - - - - MissingH's absNormPath does not work on Windows, so on Windows - - no normalization is done. -} absNormPath :: FilePath -> FilePath -> Maybe FilePath #ifndef mingw32_HOST_OS absNormPath dir path = MissingH.absNormPath dir path #else -absNormPath dir path = Just $ combine dir path +absNormPath dir path = todos <$> MissingH.absNormPath (fromdos dir) (fromdos path) + where + fromdos = replace "\\" "/" + todos = replace "/" "\\" #endif {- Returns the parent directory of a path. |