Fix Windows build with Win32 2.13.4+

Thanks, Oleg Tolmatcev
This commit is contained in:
Joey Hess 2024-06-03 13:04:15 -04:00
parent 176eb9c9c6
commit da2c02162c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,10 @@
git-annex (10.20240532) UNRELEASED; urgency=medium
* Fix Windows build with Win32 2.13.4+
Thanks, Oleg Tolmatcev
-- Joey Hess <id@joeyh.name> Mon, 03 Jun 2024 13:03:21 -0400
git-annex (10.20240531) upstream; urgency=medium
* git-remote-annex: New program which allows pushing a git repo to a

View file

@ -21,6 +21,9 @@ import Control.Concurrent
import Utility.Path.Windows
import Utility.FileSystemEncoding
#if MIN_VERSION_Win32(2,13,4)
import Common (tryNonAsync)
#endif
type LockFile = RawFilePath
@ -59,9 +62,9 @@ openLock :: ShareMode -> LockFile -> IO (Maybe LockHandle)
openLock sharemode f = do
f' <- convertToWindowsNativeNamespace f
#if MIN_VERSION_Win32(2,13,4)
r <- tryNonAsync $ createFile_NoRetry f' gENERIC_READ sharemode
security_attributes oPEN_ALWAYS fILE_ATTRIBUTE_NORMAL
(maybePtr Nothing)
r <- tryNonAsync $ createFile_NoRetry (fromRawFilePath f') gENERIC_READ sharemode
Nothing oPEN_ALWAYS fILE_ATTRIBUTE_NORMAL
Nothing
return $ case r of
Left _ -> Nothing
Right h -> Just h