mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Compare filesizes to verify the hardlinking worked on windows, more robust
This commit is contained in:
parent
7a174b5bc8
commit
88620ed588
@ -307,7 +307,7 @@ class WindowsAtomicFolderMove(object):
|
|||||||
' operation was started'%path)
|
' operation was started'%path)
|
||||||
try:
|
try:
|
||||||
win32file.CreateHardLink(dest, path)
|
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.')
|
raise Exception('This apparently can happen on network shares. Sigh.')
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
@ -348,7 +348,7 @@ def hardlink_file(src, dest):
|
|||||||
if iswindows:
|
if iswindows:
|
||||||
import win32file
|
import win32file
|
||||||
win32file.CreateHardLink(dest, src)
|
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.')
|
raise Exception('This apparently can happen on network shares. Sigh.')
|
||||||
return
|
return
|
||||||
os.link(src, dest)
|
os.link(src, dest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user