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..
This commit is contained in:
parent
a44e01c29c
commit
0fc3ad82c5
3 changed files with 16 additions and 5 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue