diff --git a/src/plugins/export/ExportPkg.py b/src/plugins/export/ExportPkg.py index fb96584ff..bcc33ac0f 100644 --- a/src/plugins/export/ExportPkg.py +++ b/src/plugins/export/ExportPkg.py @@ -31,6 +31,7 @@ # #------------------------------------------------------------------------- import time +import shutil import os import sys import tarfile @@ -70,6 +71,16 @@ import Utils # #------------------------------------------------------------------------- def writeData(database, filename, option_box=None, callback=None): +# Rename file, if it exists already, with .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: option_box.parse_options() @@ -242,4 +253,4 @@ plugin = ExportPlugin(name = _('GRAM_PS package (portable XML)'), export_function = writeData, extension = "gpkg", config = _config ) -pmgr.register_plugin(plugin) \ No newline at end of file +pmgr.register_plugin(plugin)