775
775
return _platform_normalizes_filenames
778
def _accessible_unicode_filename(path):
779
"""Get the unicode normalized path, and if you can access the file.
781
On platforms where the system normalizes filenames (Mac OSX),
782
you can access a file by any path which will normalize correctly.
783
On platforms where the system does not normalize filenames
784
(Windows, Linux), you have to access a file by its exact path.
786
Internally, bzr only supports NFC/NFKC normalization, since that is
787
the standard for XML documents.
789
So return the normalized path, and a flag indicating if the file
790
can be accessed by that path.
793
return unicodedata.normalize('NFKC', path), True
796
def _inaccessible_unicode_filename(path):
797
__doc__ = _accessible_unicode_filename.__doc__
799
normalized = unicodedata.normalize('NFKC', path)
800
return normalized, normalized == path
778
803
if _platform_normalizes_filenames:
779
def unicode_filename(path):
780
"""Make sure 'path' is a properly normalized filename.
782
On platforms where the system normalizes filenames (Mac OSX),
783
you can access a file by any path which will normalize
785
Internally, bzr only supports NFC/NFKC normalization, since
786
that is the standard for XML documents.
787
So we return an normalized path, and indicate this has been
790
:return: (path, is_normalized) Return a path which can
791
access the file, and whether or not this path is
794
return unicodedata.normalize('NFKC', path), True
804
unicode_filename = _accessible_unicode_filename
796
def unicode_filename(path):
797
"""Make sure 'path' is a properly normalized filename.
799
On platforms where the system does not normalize filenames
800
(Windows, Linux), you have to access a file by its exact path.
801
Internally, bzr only supports NFC/NFKC normalization, since
802
that is the standard for XML documents.
803
So we return the original path, and indicate if this is
806
:return: (path, is_normalized) Return a path which can
807
access the file, and whether or not this path is
810
return path, unicodedata.normalize('NFKC', path) == path
806
unicode_filename = _inaccessible_unicode_filename
813
809
def terminal_width():