Create "eds" folder if it doesn't exist in any case
authorlbessard
Tue, 04 Sep 2007 17:47:04 +0200
changeset 265 36cc4c87cdaa
parent 264 6fa295ec7dda
child 266 8678a3cf7fe7
Create "eds" folder if it doesn't exist in any case
objdictgen/networkedit.py
objdictgen/nodelist.py
--- a/objdictgen/networkedit.py	Fri Aug 31 10:20:10 2007 +0200
+++ b/objdictgen/networkedit.py	Tue Sep 04 17:47:04 2007 +0200
@@ -441,7 +441,6 @@
         if dialog.ShowModal() == wx.ID_OK:
             projectpath = dialog.GetPath()
             if os.path.isdir(projectpath) and len(os.listdir(projectpath)) == 0:
-                os.mkdir(os.path.join(projectpath, "eds"))
                 manager = NodeManager()
                 nodelist = NodeList(manager)
                 result = nodelist.LoadProject(projectpath)
--- a/objdictgen/nodelist.py	Fri Aug 31 10:20:10 2007 +0200
+++ b/objdictgen/nodelist.py	Tue Sep 04 17:47:04 2007 +0200
@@ -92,7 +92,8 @@
         
         self.EDSFolder = os.path.join(self.Root, "eds")
         if not os.path.exists(self.EDSFolder):
-            return "\"%s\" folder doesn't contain a \"eds\" folder"%self.Root
+            os.mkdir(self.EDSFolder)
+            #return "\"%s\" folder doesn't contain a \"eds\" folder"%self.Root
         
         files = os.listdir(self.EDSFolder)
         for file in files:
@@ -162,10 +163,9 @@
         else:
             masterpath = os.path.join(self.Root, "master.od")
         if os.path.isfile(masterpath):
-            self.Manager.OpenFileInCurrent(masterpath)
-        else:
-            self.Manager.CreateNewNode("MasterNode", 0x00, "master", "", "None", "", "heartbeat", ["DS302"])
-        return None
+            return self.Manager.OpenFileInCurrent(masterpath)
+        else:
+            return self.Manager.CreateNewNode("MasterNode", 0x00, "master", "", "None", "", "heartbeat", ["DS302"])
     
     def SaveMasterNode(self, netname = None):
         if netname: