Project/Project.py

changeset 651
e8020b9ac2b9
parent 613
5a6ee2af8ec0
child 765
e5cbb3f273eb
--- a/Project/Project.py	Sun Oct 03 10:47:20 2010 +0200
+++ b/Project/Project.py	Sun Oct 03 11:29:27 2010 +0200
@@ -14,7 +14,6 @@
 import fnmatch
 import copy
 import zipfile
-import io
 import re
 
 from PyQt4.QtCore import *
@@ -1810,6 +1809,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)
@@ -1834,8 +1842,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