##// END OF EJS Templates
util_win32: make os_link more robust (issue 761)...
Patrick Mezard -
r5879:cacfeee3 default
parent child Browse files
Show More
@@ -146,9 +146,18 b' class WinOSError(WinError, OSError):'
146 self.win_strerror)
146 self.win_strerror)
147
147
148 def os_link(src, dst):
148 def os_link(src, dst):
149 # NB will only succeed on NTFS
150 try:
149 try:
151 win32file.CreateHardLink(dst, src)
150 win32file.CreateHardLink(dst, src)
151 # CreateHardLink sometimes succeeds on mapped drives but
152 # following nlinks() returns 1. Check it now and bail out.
153 if nlinks(src) < 2:
154 try:
155 win32file.DeleteFile(dst)
156 except:
157 pass
158 # Fake hardlinking error
159 raise WinOSError((18, 'CreateHardLink', 'The system cannot '
160 'move the file to a different disk drive'))
152 except pywintypes.error, details:
161 except pywintypes.error, details:
153 raise WinOSError(details)
162 raise WinOSError(details)
154
163
General Comments 0
You need to be logged in to leave comments. Login now