From 9daa095665bc95ec9c7f56999c9c45a5e64538a2 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 10 Jul 2019 11:47:54 +0200 Subject: [PATCH] Enhancing update system --- src/CNIRevelator.py | 3 +++ src/updater.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/CNIRevelator.py b/src/CNIRevelator.py index b586b9e..7b2f719 100644 --- a/src/CNIRevelator.py +++ b/src/CNIRevelator.py @@ -69,5 +69,8 @@ except Exception: logfile.printerr("A FATAL ERROR OCCURED : " + str(traceback.format_exc())) sys.exit(1) +if updater.UPDATE_IS_MADE: + sys.exit(0) + main() sys.exit(0) diff --git a/src/updater.py b/src/updater.py index 5a5ea85..7b92bc3 100644 --- a/src/updater.py +++ b/src/updater.py @@ -38,6 +38,8 @@ import globs # globs.py import ihm # ihm.py import downloader # downloader.py +UPDATE_IS_MADE = False + def createShortcut(path, target='', wDir='', icon=''): ext = path[-3:] if ext == 'url': @@ -175,15 +177,19 @@ def batch(): launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Success !')) + # Cleanup + try: + os.remove(globs.CNIRFolder + '\\..\\CNIPackage.zip') + except: + pass # Launch app ! args = [UPATH + '\\CNIRevelator.exe', globs.CNIRFolder] subprocess.Popen(args) launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Launched the new process.')) - launcherWindow.destroy() - sys.exit(0) - return + UPDATE_IS_MADE = True + return True ## Main Function def umain():