--- a/ProjectController.py Tue May 23 16:06:29 2017 +0300
+++ b/ProjectController.py Tue May 30 17:09:33 2017 +0300
@@ -88,25 +88,50 @@
- self.iec2c = os.path.join(base_folder, "matiec", "iec2c"+(".exe" if wx.Platform == '__WXMSW__' else ""))
self.iec2c_buildopts = None
- self.ieclib_path = os.path.join(base_folder, "matiec", "lib")
- self.ieclib_c_path = None
+ self.ieclib_path = self.findLibPath() + self.ieclib_c_path = self.findLibCPath() - def findLibCPath(self):
+ def findObject(self, paths, test): + cmd="iec2c"+(".exe" if wx.Platform == '__WXMSW__' else "") - os.path.join(base_folder, "matiec", "lib", "C"),
- os.path.join(base_folder, "matiec", "lib") ]
- filename=os.path.join(p, "iec_types.h")
- if (os.path.isfile(filename)):
+ os.path.join(base_folder, "matiec") + path = self.findObject(paths, lambda p:os.path.isfile(os.path.join(p, cmd))) + # otherwise use iec2c from PATH + cmd=os.path.join(path, cmd) + os.path.join(base_folder, "matiec", "lib"), + path = self.findObject(paths, lambda p:os.path.isfile(os.path.join(p, "ieclib.txt"))) + def findLibCPath(self): + os.path.join(self.ieclib_path, "C"), + path = self.findObject(paths, lambda p:os.path.isfile(os.path.join(p, "iec_types.h"))) def findSupportedOptions(self):
- buildcmd = "\"%s\" -h"%(self.iec2c)
+ buildcmd = "\"%s\" -h"%(self.getCmd()) options =["-f", "-l", "-p"]
@@ -123,6 +148,8 @@
+ self.iec2c = self.findCmd()