Compare filesizes to verify the hardlinking worked on windows, more robust

This commit is contained in:
Kovid Goyal 2012-10-29 09:01:28 +05:30
parent 7a174b5bc8
commit 88620ed588

View File

@ -307,7 +307,7 @@ class WindowsAtomicFolderMove(object):
' operation was started'%path)
try:
win32file.CreateHardLink(dest, path)
if not os.path.exists(dest):
if os.path.getsize(dest) != os.path.getsize(path):
raise Exception('This apparently can happen on network shares. Sigh.')
return
except:
@ -348,7 +348,7 @@ def hardlink_file(src, dest):
if iswindows:
import win32file
win32file.CreateHardLink(dest, src)
if not os.path.exists(dest):
if os.path.getsize(dest) != os.path.getsize(src):
raise Exception('This apparently can happen on network shares. Sigh.')
return
os.link(src, dest)