fixed file name with Chinese encoding issue, which is merged from chaos.proton@gmail.com.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1779 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2011-10-30 00:44:18 +00:00
parent 7b6f018f73
commit 6aa93f460a
1 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@ BuildOptions = {}
Projects = []
Rtt_Root = ''
Env = None
fs_encoding = sys.getfilesystemencoding()
def _get_filetype(fn):
if fn.rfind('.c') != -1 or fn.rfind('.C') != -1 or fn.rfind('.cpp') != -1:
@ -122,7 +123,7 @@ def IARAddGroup(parent, name, files, project_path):
file = SubElement(group, 'file')
file_name = SubElement(file, 'name')
file_name.text = '$PROJ_DIR$\\' + path
file_name.text = ('$PROJ_DIR$\\' + path).decode(fs_encoding)
iar_workspace = '''<?xml version="1.0" encoding="iso-8859-1"?>
@ -221,12 +222,12 @@ def MDK4AddGroup(ProjectFiles, parent, name, files, project_path):
if ProjectFiles.count(name):
name = basename + '_' + name
ProjectFiles.append(name)
file_name.text = name
file_name.text = name.decode(fs_encoding)
file_type = SubElement(file, 'FileType')
file_type.text = '%d' % _get_filetype(name)
file_path = SubElement(file, 'FilePath')
file_path.text = path
file_path.text = path.decode(fs_encoding)
def MDK4Project(target, script):
project_path = os.path.dirname(os.path.abspath(target))