From 8a96caad55694637b035b59b055b88546d234e3d Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 29 Mar 2010 13:20:38 +0000 Subject: [PATCH] Create a 'fake' VERSION file when editing a project (if it's not present) to avoid the UNKNOWN icon and title. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3294 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/bertos_utils.py | 6 +++++- wizard/vtemplates/VERSION | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 98fd23dd..4be3d536 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -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) diff --git a/wizard/vtemplates/VERSION b/wizard/vtemplates/VERSION index 3cde4dee..a767b192 100644 --- a/wizard/vtemplates/VERSION +++ b/wizard/vtemplates/VERSION @@ -1 +1 @@ -$version (local) +$version [local copy] -- 2.25.1