summaryrefslogtreecommitdiff
path: root/tools/vs.py
diff options
context:
space:
mode:
authorMeco Jianting Man <[email protected]>2021-04-10 14:00:43 +0800
committerGitHub <[email protected]>2021-04-10 14:00:43 +0800
commitb2f23f2a96a960db5464ee2a03cddda909b2c3a4 (patch)
tree68630b709427eb3b4c50ef1660859f4d6dd83553 /tools/vs.py
parent342b0a3b1f72e874c8e033ffc267bc581f548054 (diff)
parent4dc6d002167edcb482b64be9d343de8a167cc3be (diff)
Merge pull request #37 from RT-Thread/master
同步官方
Diffstat (limited to 'tools/vs.py')
-rw-r--r--tools/vs.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/vs.py b/tools/vs.py
index f51862b9d9..8025828b64 100644
--- a/tools/vs.py
+++ b/tools/vs.py
@@ -45,9 +45,12 @@ def VS_AddGroup(ProjectFiles, parent, name, files, libs, project_path):
path = _make_path_relative(project_path, path)
path = os.path.join(path, name)
-
+ try:
+ path = path.decode(fs_encoding)
+ except:
+ path = path
File = SubElement(Filter, 'File')
- File.set('RelativePath', path.decode(fs_encoding))
+ File.set('RelativePath', path)
for lib in libs:
name = os.path.basename(lib)
@@ -57,7 +60,11 @@ def VS_AddGroup(ProjectFiles, parent, name, files, libs, project_path):
path = os.path.join(path, name)
File = SubElement(Filter, 'File')
- File.set('RelativePath', path.decode(fs_encoding))
+ try:
+ path = path.decode(fs_encoding)
+ except:
+ path = path
+ File.set('RelativePath', path)
def VS_AddHeadFilesGroup(program, elem, project_path):
utils.source_ext = []
@@ -70,7 +77,11 @@ def VS_AddHeadFilesGroup(program, elem, project_path):
for f in utils.source_list:
path = _make_path_relative(project_path, f)
File = SubElement(elem, 'File')
- File.set('RelativePath', path.decode(fs_encoding))
+ try:
+ path = path.decode(fs_encoding)
+ except:
+ path = path
+ File.set('RelativePath', path)
def VSProject(target, script, program):
project_path = os.path.dirname(os.path.abspath(target))
@@ -158,12 +169,17 @@ def VSProject(target, script, program):
for path in lib_path:
inc = _make_path_relative(project_path, os.path.normpath(path))
paths.add(inc) #.replace('\\', '/')
-
+
paths = [i for i in paths]
paths.sort()
lib_paths = ';'.join(paths)
elem.set('AdditionalLibraryDirectories', lib_paths)
xml_indent(root)
- out.write(etree.tostring(root, encoding='utf-8'))
+ text = etree.tostring(root, encoding='utf-8')
+ try:
+ text = text.decode(encoding="utf-8")
+ except:
+ text = text
+ out.write(text)
out.close()