diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-06 17:08:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-06 17:17:35 -0400 |
commit | 2d724015bdfdeb54d130d8e9a240f3fbe75306c7 (patch) | |
tree | 1f6f56812469df57af5971d47d7cbf3e564d4c9a /Utility | |
parent | d802f73243adb29b4436d0f0fd80660d78dacc58 (diff) |
work around absNormPath not working on Windows
When making git-annex links, we want unix-style paths in the link targets.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Path.hs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs index 44ac72f06..78d359bef 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 @@ -42,7 +42,18 @@ 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 = MissingH.absNormPath dir path +#endif + +{- On Windows, this converts the paths to unix-style, in order to run + - MissingH's absNormPath on them. Resulting path will use / separators. -} +#ifndef mingw32_HOST_OS +absNormPathUnix dir path = MissingH.absNormPath dir path +#else +absNormPathUnix dir path = Just $ combine dir path +absNormPathUnix dir path = MissingH.absNormPath (fromdos dir) (fromdos path) + where + fromdos = replace "\\" "/" #endif {- Returns the parent directory of a path. |