diff options
Diffstat (limited to 'tools/vs.py')
| -rw-r--r-- | tools/vs.py | 28 |
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() |
