Project/Project.py

branch
5_0_x
changeset 647
087c2941bd02
parent 521
29a1a1771e5a
child 792
a13346916170
--- a/Project/Project.py	Sun Sep 26 15:23:26 2010 +0200
+++ b/Project/Project.py	Sun Oct 03 11:30:02 2010 +0200
@@ -2310,6 +2310,15 @@
                     f = open(fn, "w", encoding = "utf-8")
                     f.close()
                     self.appendFile(fn, True)
+                # create an empty main script file, if a name was given
+                if len(self.pdata["MAINSCRIPT"]) and self.pdata["MAINSCRIPT"][0]:
+                    if not os.path.isabs(self.pdata["MAINSCRIPT"][0]):
+                        ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])
+                    else:
+                        ms = self.pdata["MAINSCRIPT"][0]
+                    f = open(ms, "w")
+                    f.close()
+                    self.appendFile(ms, True)
                 tpd = os.path.join(self.ppath, self.translationsRoot)
                 if not self.translationsRoot.endswith(os.sep):
                     tpd = os.path.dirname(tpd)
@@ -2334,8 +2343,10 @@
                 
                 try:
                     ms = os.path.join(self.ppath, self.pdata["MAINSCRIPT"][0])
-                    if os.path.exists(ms):
-                        self.appendFile(ms)
+                    if not os.path.exists(ms):
+                        f = open(ms, "w")
+                        f.close()
+                    self.appendFile(ms)
                 except IndexError:
                     ms = ""
                 

eric ide

mercurial