Do not crash on unicode filenames

Review Request #1193 — Created Oct. 21, 2014 and submitted — Latest diff uploaded

dturner-tw
pants
d4ef453...
pants-reviews
benjyw, ity, jinfeng, jsirois, peiyu, stuhood

Introduce a new function, safe_walk, which wraps os.path.walk, but
ensures that the returned values are unicode objects. This isn't
strictly safe, in that it is possible that some paths will not be
decodeable, but that case is rare, and the only alternative is to
somehow avoid all interaction between paths and unicode objects, which
seems especially tough in the presence of unicode_literals. See e.g.
https://mail.python.org/pipermail/python-dev/2008-December/083856.html

Note that rbcommons has mangled the filename of the newly added file -- it is in fact testprojects/tests/java/com/pants/testproject/unicode/中文/.gitsave (if you download the diff and apply it, all will be well).

Ran new test.

Loading...