tools: fix cpplint.py when path contains non-ascii
PR-URL: https://github.com/nodejs/node/pull/16047 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
3690a72347
commit
22882d4094
6
tools/cpplint.py
vendored
6
tools/cpplint.py
vendored
@ -1074,8 +1074,8 @@ class FileInfo(object):
|
|||||||
"""
|
"""
|
||||||
fullname = self.FullName()
|
fullname = self.FullName()
|
||||||
# XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory.
|
# XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory.
|
||||||
toplevel = os.path.abspath(
|
toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) \
|
||||||
os.path.join(os.path.dirname(__file__), '..')).replace('\\', '/')
|
.replace('\\', '/').decode('utf-8')
|
||||||
prefix = os.path.commonprefix([fullname, toplevel])
|
prefix = os.path.commonprefix([fullname, toplevel])
|
||||||
return fullname[len(prefix) + 1:]
|
return fullname[len(prefix) + 1:]
|
||||||
|
|
||||||
@ -6084,7 +6084,7 @@ def main():
|
|||||||
|
|
||||||
_cpplint_state.ResetErrorCounts()
|
_cpplint_state.ResetErrorCounts()
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
ProcessFile(filename, _cpplint_state.verbose_level)
|
ProcessFile(filename.decode('utf-8'), _cpplint_state.verbose_level)
|
||||||
_cpplint_state.PrintErrorCounts()
|
_cpplint_state.PrintErrorCounts()
|
||||||
|
|
||||||
sys.exit(_cpplint_state.error_count > 0)
|
sys.exit(_cpplint_state.error_count > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user