diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-12-14 12:55:53 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-12-14 12:55:53 -0400 |
commit | 5ca81d114d7ccf0ee984cb03f56ad6ec1d9499f0 (patch) | |
tree | 4b49c7c03e77f356dd3941070509a498d97a3290 /Utility/Path.hs | |
parent | 3a59749f2c0603872109a85c44234dd744d059cc (diff) | |
download | git-repair-5ca81d114d7ccf0ee984cb03f56ad6ec1d9499f0.tar.gz |
Merge from git-annex.
Diffstat (limited to 'Utility/Path.hs')
-rw-r--r-- | Utility/Path.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs index 0779d16..dc91ce5 100644 --- a/Utility/Path.hs +++ b/Utility/Path.hs @@ -136,17 +136,22 @@ relPathDirToFile from to = relPathDirToFileAbs <$> absPath from <*> absPath to -} relPathDirToFileAbs :: FilePath -> FilePath -> FilePath relPathDirToFileAbs from to - | takeDrive from /= takeDrive to = to +#ifdef mingw32_HOST_OS + | normdrive from /= normdrive to = to +#endif | otherwise = joinPath $ dotdots ++ uncommon where pfrom = sp from pto = sp to - sp = map dropTrailingPathSeparator . splitPath + sp = map dropTrailingPathSeparator . splitPath . dropDrive common = map fst $ takeWhile same $ zip pfrom pto same (c,d) = c == d uncommon = drop numcommon pto dotdots = replicate (length pfrom - numcommon) ".." numcommon = length common +#ifdef mingw32_HOST_OS + normdrive = map toLower . takeWhile (/= ':') . takeDrive +#endif prop_relPathDirToFile_basics :: FilePath -> FilePath -> Bool prop_relPathDirToFile_basics from to |