File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,7 @@ makeRelative root path
933
933
-- > Posix: normalise "./bob/fred/" == "bob/fred/"
934
934
-- > Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\"
935
935
-- > Windows: normalise "c:\\" == "C:\\"
936
+ -- > Windows: normalise "c:\\\\\\\\" == "C:\\"
936
937
-- > Windows: normalise "C:.\\" == "C:"
937
938
-- > Windows: normalise "\\\\server\\test" == "\\\\server\\test"
938
939
-- > Windows: normalise "//server/test" == "\\\\server\\test"
@@ -984,9 +985,12 @@ normaliseDrive :: FILEPATH -> FILEPATH
984
985
normaliseDrive bs
985
986
| null bs = mempty
986
987
| isPosix = pack [pathSeparator]
987
- | otherwise = if isJust $ readDriveLetter x2
988
- then map toUpper x2
989
- else x2
988
+ | Just (drv, _) <- readDriveLetter x2
989
+ = case unpack drv of
990
+ (x: _: [] ) -> pack [toUpper x, _colon]
991
+ (x: _) -> pack [toUpper x, _colon, pathSeparator]
992
+ _ -> P. error " impossible"
993
+ | otherwise = x2
990
994
where
991
995
x2 = map repSlash bs
992
996
repSlash x = if isPathSeparator x then pathSeparator else x
Original file line number Diff line number Diff line change @@ -812,6 +812,8 @@ tests =
812
812
,(" AFP_W.normalise (\" c:\\\\ file/bob\\\\\" ) == (\" C:\\\\ file\\\\ bob\\\\\" )" , property $ AFP_W. normalise (" c:\\ file/bob\\ " ) == (" C:\\ file\\ bob\\ " ))
813
813
,(" W.normalise \" c:\\\\\" == \" C:\\\\\" " , property $ W. normalise " c:\\ " == " C:\\ " )
814
814
,(" AFP_W.normalise (\" c:\\\\\" ) == (\" C:\\\\\" )" , property $ AFP_W. normalise (" c:\\ " ) == (" C:\\ " ))
815
+ ,(" W.normalise \" c:\\\\\\\\\\\\\\\\\" == \" C:\\\\\" " , property $ W. normalise " c:\\\\\\\\ " == " C:\\ " )
816
+ ,(" AFP_W.normalise (\" c:\\\\\\\\\\\\\\\\\" ) == (\" C:\\\\\" )" , property $ AFP_W. normalise (" c:\\\\\\\\ " ) == (" C:\\ " ))
815
817
,(" W.normalise \" C:.\\\\\" == \" C:\" " , property $ W. normalise " C:.\\ " == " C:" )
816
818
,(" AFP_W.normalise (\" C:.\\\\\" ) == (\" C:\" )" , property $ AFP_W. normalise (" C:.\\ " ) == (" C:" ))
817
819
,(" W.normalise \"\\\\\\\\ server\\\\ test\" == \"\\\\\\\\ server\\\\ test\" " , property $ W. normalise " \\\\ server\\ test" == " \\\\ server\\ test" )
You can’t perform that action at this time.
0 commit comments