]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Remove old log file before the application start jfa/29467_gui_log_file
authorjfa <jfa@opencascade.com>
Mon, 30 May 2022 14:36:28 +0000 (17:36 +0300)
committerjfa <jfa@opencascade.com>
Mon, 30 May 2022 14:36:28 +0000 (17:36 +0300)
bin/runSalomeCommon.py

index a31aee6d9d96845c0caa9d7f00ae4cfcfa6545f5..6578e3f95ad01105220b0f910cff486c59ba9169 100755 (executable)
@@ -302,7 +302,15 @@ class CommonSessionServer(Server):
                     pass
                 pass
                 if self.args['gui_log_file'] is not None:
-                    self.SCMD2+=['--gui-log-file=%s'%self.args['gui_log_file']]
+                    guilogfile = self.args['gui_log_file']
+                    if os.path.exists(guilogfile) and os.path.isfile(guilogfile):
+                        try:
+                            os.remove(guilogfile)
+                        except:
+                            print("Error: cannot remove existing log file", guilogfile)
+                            guilogfile = None
+                    if guilogfile is not None:
+                        self.SCMD2+=['--gui-log-file=%s'%guilogfile]
                     pass
                 pass
             pass