fix relPathDirToFileAbs on windows with different drive letters
Since we started using this for git repos, when a remote was on another drive, it resulted in a bogus relative path to it being used by git-annex, which didn't work.
This commit is contained in:
parent
595d9f5ab0
commit
f84ccaa4e8
4 changed files with 13 additions and 1 deletions
|
@ -138,9 +138,15 @@ relPathDirToFile from to = relPathDirToFileAbs <$> absPath from <*> absPath to
|
|||
|
||||
{- This requires the first path to be absolute, and the
|
||||
- second path cannot contain ../ or ./
|
||||
-
|
||||
- On Windows, if the paths are on different drives,
|
||||
- a relative path is not possible and the path is simply
|
||||
- returned as-is.
|
||||
-}
|
||||
relPathDirToFileAbs :: FilePath -> FilePath -> FilePath
|
||||
relPathDirToFileAbs from to = join s $ dotdots ++ uncommon
|
||||
relPathDirToFileAbs from to
|
||||
| takeDrive from /= takeDrive to = to
|
||||
| otherwise = join s $ dotdots ++ uncommon
|
||||
where
|
||||
s = [pathSeparator]
|
||||
pfrom = split s from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue