fix removeLink on windows
authorJoey Hess <joeyh@joeyh.name>
Thu, 19 Nov 2020 16:20:18 +0000 (12:20 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 19 Nov 2020 16:20:18 +0000 (12:20 -0400)
This removeLink was introduced in commit
e505c03bccdc6567cd517a6ddaf70a411489473d, which replaced code
that used removeFile on Windows. So, I know git-annex did not used to do
anything other than removeFile on Windows. If there were symlinks it
wanted to remove, this would not work on windows, but of course it does
not use symlinks on windows.

Utility/RawFilePath.hs

index 362ae70cd128d3630d42143462259d64f6b59a38..c114fd9d3de3fa7d205c72d7ef8b3691124c958f 100644 (file)
@@ -66,8 +66,10 @@ createLink a b = P.createLink
        (fromRawFilePath a)
        (fromRawFilePath b)
 
+{- On windows, removeLink is not available, so only remove files,
+ - not symbolic links. -}
 removeLink :: RawFilePath -> IO ()
-removeLink = P.removeLink . fromRawFilePath
+removeLink = D.removeFile . fromRawFilePath
 
 getFileStatus :: RawFilePath -> IO FileStatus
 getFileStatus = P.getFileStatus . fromRawFilePath