Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26063/pywin/framework/editor
Modified Files:
document.py
Log Message:
Use shutil.copy2 instead of os.rename for the backup file to prevent
potential problems with links - and the operation is logically a copy
rather than a rename.
Index: document.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/document.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** document.py 4 Jun 2000 06:04:03 -0000 1.8
--- document.py 20 Nov 2006 12:35:01 -0000 1.9
***************
*** 9,12 ****
--- 9,13 ----
import traceback
import win32api
+ import shutil
BAK_NONE=0
***************
*** 68,72 ****
pass
try:
! os.rename(fileName, bakFileName)
except (os.error, NameError):
pass
--- 69,76 ----
pass
try:
! # Do a copy as it might be on different volumes,
! # and the file may be a hard-link, causing the link
! # to follow the backup.
! shutil.copy2(fileName, bakFileName)
except (os.error, NameError):
pass
|