Skip to content

Commit

Permalink
tools: fix cpplint.py when path contains non-ascii
Browse files Browse the repository at this point in the history
PR-URL: #16047
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
sharkfisher authored and MylesBorins committed Nov 28, 2017
1 parent 8663b05 commit a8d7f5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@ def RepositoryName(self):
"""
fullname = self.FullName()
# XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory.
toplevel = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')).replace('\\', '/')
toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) \
.replace('\\', '/').decode('utf-8')
prefix = os.path.commonprefix([fullname, toplevel])
return fullname[len(prefix) + 1:]

Expand Down Expand Up @@ -6084,7 +6084,7 @@ def main():

_cpplint_state.ResetErrorCounts()
for filename in filenames:
ProcessFile(filename, _cpplint_state.verbose_level)
ProcessFile(filename.decode('utf-8'), _cpplint_state.verbose_level)
_cpplint_state.PrintErrorCounts()

sys.exit(_cpplint_state.error_count > 0)
Expand Down

0 comments on commit a8d7f5f

Please sign in to comment.