Create a 'fake' VERSION file when editing a project (if it's not present) to avoid...
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 29 Mar 2010 13:20:38 +0000 (13:20 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 29 Mar 2010 13:20:38 +0000 (13:20 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3294 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py
wizard/vtemplates/VERSION

index 98fd23dde905930765964e160d0d00c35a17564b..4be3d536c1e4677e723c0218ce2e2043b9204550 100644 (file)
@@ -58,19 +58,23 @@ def bertosVersion(directory):
    return open(directory + "/VERSION").readline().strip()
 
 def loadBertosProject(project_file, info_dict):
+    project_dir = os.path.dirname(project_file)
     project_data = pickle.loads(open(project_file, "r").read())
     project_info = BProject.BProject()
     project_info.setInfo("PROJECT_PATH", os.path.dirname(project_file))
     # Check for the Wizard version
     wizard_version = project_data.get("WIZARD_VERSION", 0)
     if not wizard_version:
-        project_data["SOURCES_PATH"] = os.path.dirname(project_file)
+        project_data["SOURCES_PATH"] = project_dir
     if "SOURCES_PATH" in info_dict:
         project_data["SOURCES_PATH"] = info_dict["SOURCES_PATH"]
     if os.path.exists(project_data["SOURCES_PATH"]):
         project_info.setInfo("SOURCES_PATH", project_data["SOURCES_PATH"])
     else:
         raise VersionException(project_info)
+    if not isBertosDir(os.path.dirname(project_file)):
+        version_file = open(os.path.join(const.DATA_DIR, "vtemplates/VERSION"), "r").read()
+        open(os.path.join(project_dir, "VERSION"), "w").write(version_file.replace("$version", "").strip())
     loadSourceTree(project_info)
     cpu_name = project_data["CPU_NAME"]
     project_info.setInfo("CPU_NAME", cpu_name)
index 3cde4deebd27ba29d19df8d0419230207b5e8b16..a767b1929172d138ad1c3df455502dd967268fff 100644 (file)
@@ -1 +1 @@
-$version (local)
+$version [local copy]