fix prop_relPathDirToFileAbs_basics fail on windows

It was just slapping on a path separator to the front of the path to
make it absolute, but on windows, a path like "//foo/bar" actually
has a network "drive" of "//foo" and so that broke the test case.

Since "a:foo" is a somehow relative path on windows
(who knows how), drop any drive from the input. But dropDrive also drops
any leading path separator, making the input path relative. So now
it should be safe to slapp on a leading path separator.
This commit is contained in:
Joey Hess 2021-01-18 13:19:17 -04:00
parent 75358f98b0
commit 7eb54bad12
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 6 additions and 1 deletions

View file

@ -42,7 +42,10 @@ prop_relPathDirToFileAbs_basics pt = and
, relPathDirToFileAbs p p == ""
]
where
p = pathSeparator `B.cons` toRawFilePath (fromTestableFilePath pt)
-- Make the input an absolute path, since relPathDirToFileAbs
-- needs absolute paths.
p = pathSeparator `B.cons` dropDrive
(toRawFilePath (fromTestableFilePath pt))
prop_relPathDirToFileAbs_regressionTest :: Bool
prop_relPathDirToFileAbs_regressionTest = same_dir_shortcurcuits_at_difference

View file

@ -15,3 +15,5 @@ full list of recent runs with logs etc: [datalad/git-annex github actions](https
[[!meta author=yoh]]
[[!tag projects/datalad]]
> [[fixed|done]] --[[Joey]]