mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Avoid unnecessary string formatting
This commit is contained in:
parent
ef4efd5768
commit
c950518da2
@ -259,10 +259,10 @@ def samefile(src, dst):
|
|||||||
|
|
||||||
def windows_hardlink(src, dest):
|
def windows_hardlink(src, dest):
|
||||||
import win32file, pywintypes
|
import win32file, pywintypes
|
||||||
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
|
|
||||||
try:
|
try:
|
||||||
win32file.CreateHardLink(dest, src)
|
win32file.CreateHardLink(dest, src)
|
||||||
except pywintypes.error as e:
|
except pywintypes.error as e:
|
||||||
|
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
|
||||||
raise Exception(msg % e)
|
raise Exception(msg % e)
|
||||||
# We open and close dest, to ensure its directory entry is updated
|
# We open and close dest, to ensure its directory entry is updated
|
||||||
# see http://blogs.msdn.com/b/oldnewthing/archive/2011/12/26/10251026.aspx
|
# see http://blogs.msdn.com/b/oldnewthing/archive/2011/12/26/10251026.aspx
|
||||||
@ -273,6 +273,7 @@ def windows_hardlink(src, dest):
|
|||||||
win32file.CloseHandle(h)
|
win32file.CloseHandle(h)
|
||||||
|
|
||||||
if sz != os.path.getsize(src):
|
if sz != os.path.getsize(src):
|
||||||
|
msg = u'Creating hardlink from %s to %s failed: %%s' % (src, dest)
|
||||||
raise Exception(msg % ('hardlink size: %d not the same as source size' % sz))
|
raise Exception(msg % ('hardlink size: %d not the same as source size' % sz))
|
||||||
|
|
||||||
class WindowsAtomicFolderMove(object):
|
class WindowsAtomicFolderMove(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user