canfestival/canfestival.py
branch1.1 Korean release
changeset 977 c8e008b8cefe
parent 976 0ba3d9cd61e8
child 1003 de812e258213
--- a/canfestival/canfestival.py	Thu Mar 07 11:47:43 2013 +0900
+++ b/canfestival/canfestival.py	Wed Mar 13 12:34:55 2013 +0900
@@ -399,12 +399,23 @@
                         child["type"] = local_canfestival_config.DLL_LIST
         return infos
     
+    def GetCanDriver(self):
+        res = self.CanFestivalInstance.getCAN_Driver()
+        if not res :
+            return ""
+        return res
+        
     def CTNGenerate_C(self, buildpath, locations):
-        can_driver = self.CanFestivalInstance.getCAN_Driver()
-        if not can_driver :
-            can_driver = local_canfestival_config.DLL_LIST[0]
-        can_drv_ext = self.GetCTRoot().GetBuilder().extension
-        can_driver_name = "libcanfestival_" + can_driver + can_drv_ext
+        can_driver = self.GetCanDriver()
+        if can_driver is not None:
+            can_drivers = local_canfestival_config.DLL_LIST
+            if can_driver not in can_drivers :
+                can_driver = can_drivers[0]
+            can_drv_ext = self.GetCTRoot().GetBuilder().extension
+            can_driver_name = "libcanfestival_" + can_driver + can_drv_ext
+        else:
+            can_driver_name = ""
+
         
         format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())),
                        "candriver" : can_driver_name,
@@ -500,10 +511,11 @@
         f.close()
 
         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
-
-        can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
-        if os.path.exists(can_driver_path):
-            res += ((can_driver_name, file(can_driver_path,"rb")),)
+        
+        if can_driver is not None:
+            can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
+            if os.path.exists(can_driver_path):
+                res += ((can_driver_name, file(can_driver_path,"rb")),)
 
         return res