summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2015-04-08 00:52:42 +0800
committer[email protected] <[email protected]>2015-04-08 00:52:42 +0800
commit7e260dbcce375152eaa52d3be5f1f8465943bd5d (patch)
treef10311176feb771264f5591cfeaaa5a803639d14
parent2eaaa2cb0562a619d47cecd521ecc9659f93920d (diff)
修正rtt-root位于其他目录时计算目录错误的bug
-rw-r--r--tools/vs2012.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/vs2012.py b/tools/vs2012.py
index 6badef8ad9..63457e0a0a 100644
--- a/tools/vs2012.py
+++ b/tools/vs2012.py
@@ -90,6 +90,9 @@ def VS2012_CreateFilter(script, project_path):
# files: c/h list
# project_path
def VS_add_ItemGroup(parent, file_type, files, project_path):
+ from building import Rtt_Root
+ RTT_ROOT = os.path.normpath(Rtt_Root)
+
file_dict = {'C':"ClCompile", 'H':'ClInclude'}
item_tag = file_dict[file_type]
@@ -99,7 +102,18 @@ def VS_add_ItemGroup(parent, file_type, files, project_path):
name = fn.name
path = os.path.dirname(fn.abspath)
- objpath = path = _make_path_relative(project_path, path)
+ objpath = path.lower()
+ if len(project_path) >= len(RTT_ROOT) :
+ if objpath.startswith(project_path.lower()) :
+ objpath = ''.join('bsp'+objpath[len(project_path):])
+ else :
+ objpath = ''.join('kernel'+objpath[len(RTT_ROOT):])
+ else :
+ if objpath.startswith(RTT_ROOT.lower()) :
+ objpath = ''.join('kernel'+objpath[len(RTT_ROOT):])
+ else :
+ objpath = ''.join('bsp'+objpath[len(project_path):])
+ path = _make_path_relative(project_path, path)
path = os.path.join(path, name)
File = SubElement(ItemGroup, item_tag)