lpcmanager

Fixed Clean function.

2016-11-17, dgaberscek
74629cc7e370
Parents 9503c17da3a2
Children f5dff8aab8be
Fixed Clean function.
--- a/LPCManager.py Thu Nov 17 10:29:04 2016 +0100
+++ b/LPCManager.py Thu Nov 17 11:06:53 2016 +0100
@@ -490,6 +490,7 @@
self.logger.write(_("Export file is not created because eror: %s\n") % e)
def _Build(self):
+ self._Clean()
save = self.ProjectTestModified()
if save:
self.SaveProject()
@@ -990,13 +991,15 @@
def _Clean(self):
self._CloseView(self._IECCodeView)
+ runtime_list = fnmatch.filter(os.listdir(self._getBuildPath()), 'runtime_*')
if os.path.isdir(os.path.join(self._getBuildPath())) and os.path.isfile(
- os.path.join(self._getBuildPath(), "hmi.py")) and os.path.isfile(
- os.path.join(self._getBuildPath(), "runtime_2.py")):
+ os.path.join(self._getBuildPath(), "hmi.py")) or runtime_list != []:
self.logger.write(_("Cleaning the build directory\n"))
# self.logger.write(_(str(os.path.join(self._getBuildPath(), "hmi.py"))))
- os.remove(os.path.join(self._getBuildPath(), "hmi.py"))
- os.remove(os.path.join(self._getBuildPath(), "runtime_2.py"))
+ for file in runtime_list:
+ os.remove(os.path.join(self._getBuildPath(), file))
+ if os.path.isfile(os.path.join(self._getBuildPath(), "hmi.py")):
+ os.remove(os.path.join(self._getBuildPath(), "hmi.py"))
else:
self.logger.write_error(_("Build directory already clean\n"))
self.ShowMethod("_showIECcode", False)