Fix so that a copy is created, if new filename already exists. Works like normal XML export.
svn: r13494
This commit is contained in:
parent
2230220ea1
commit
bd18302d69
@ -31,6 +31,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import time
|
import time
|
||||||
|
import shutil
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
@ -69,6 +70,17 @@ import Utils
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def writeData(database, filename, option_box=None, callback=None):
|
def writeData(database, filename, option_box=None, callback=None):
|
||||||
|
|
||||||
|
# Rename file, if it exists already, with <filename>.bak
|
||||||
|
# as it it for normal XML export.
|
||||||
|
|
||||||
|
if os.path.isfile(filename):
|
||||||
|
try:
|
||||||
|
shutil.copyfile(filename, filename + ".bak")
|
||||||
|
shutil.copystat(filename, filename + ".bak")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
if option_box:
|
if option_box:
|
||||||
option_box.parse_options()
|
option_box.parse_options()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user