runtime/PLCObject.py
changeset 2596 779e8dbf1ee1
parent 2594 f1e182818434
child 2600 0e20a0d48fae
--- a/runtime/PLCObject.py	Tue Apr 16 11:26:34 2019 +0200
+++ b/runtime/PLCObject.py	Tue Apr 16 11:26:52 2019 +0200
@@ -533,6 +533,10 @@
     def _extra_files_log_path(self):
         return os.path.join(self.workingdir, "extra_files.txt")
 
+    def RepairPLC(self):
+        self.PurgePLC()
+        MainWorker.quit()
+
     @RunInMain
     def PurgePLC(self):
 
@@ -542,16 +546,19 @@
             if self.CurrentPLCFilename is not None \
             else None
 
+        allfiles = [extra_files_log, old_PLC_filename, self._GetMD5FileName()]
+
         try:
-            os.remove(old_PLC_filename)
-            for filename in open(extra_files_log, "rt").readlines() + [extra_files_log]:
-                try:
-                    os.remove(os.path.join(self.workingdir, filename.strip()))
-                except Exception:
-                    pass
+            allfiles.append(open(extra_files_log, "rt").readlines())
         except Exception:
             pass
 
+        for filename in allfiles:
+            try:
+                os.remove(os.path.join(self.workingdir, filename.strip()))
+            except Exception:
+                pass
+
         self.PLCStatus = PlcStatus.Empty
 
         # TODO: PLCObject restart