mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
...
This commit is contained in:
parent
ab44713d96
commit
190c225966
@ -278,6 +278,12 @@ class WindowsAtomicFolderMove(object):
|
|||||||
for x in os.listdir(path):
|
for x in os.listdir(path):
|
||||||
f = os.path.normcase(os.path.abspath(os.path.join(path, x)))
|
f = os.path.normcase(os.path.abspath(os.path.join(path, x)))
|
||||||
if not os.path.isfile(f): continue
|
if not os.path.isfile(f): continue
|
||||||
|
try:
|
||||||
|
# Ensure the file is not read-only
|
||||||
|
win32file.SetFileAttributes(f, win32file.FILE_ATTRIBUTE_NORMAL)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
h = win32file.CreateFile(f, win32file.GENERIC_READ,
|
h = win32file.CreateFile(f, win32file.GENERIC_READ,
|
||||||
win32file.FILE_SHARE_DELETE, None,
|
win32file.FILE_SHARE_DELETE, None,
|
||||||
@ -341,11 +347,6 @@ class WindowsAtomicFolderMove(object):
|
|||||||
def delete_originals(self):
|
def delete_originals(self):
|
||||||
import win32file
|
import win32file
|
||||||
for path in self.handle_map.iterkeys():
|
for path in self.handle_map.iterkeys():
|
||||||
try:
|
|
||||||
# Ensure the file is not read-only
|
|
||||||
win32file.SetFileAttributes(path, win32file.FILE_ATTRIBUTE_NORMAL)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
win32file.DeleteFile(path)
|
win32file.DeleteFile(path)
|
||||||
self.close_handles()
|
self.close_handles()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user