/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/osutils.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-17 19:05:13 UTC
  • mfrom: (7121.2.2 backslash-support)
  • Revision ID: breezy.the.bot@gmail.com-20181117190513-mktc25th4dc28qg5
Support adding files with filenames that are just a backslash on
platforms where it is not the path separator.

Merged from https://code.launchpad.net/~jelmer/brz/backslash-support/+merge/355135

Show diffs side-by-side

added added

removed removed

Lines of Context:
1035
1035
 
1036
1036
def splitpath(p):
1037
1037
    """Turn string into list of parts."""
1038
 
    # split on either delimiter because people might use either on
1039
 
    # Windows
1040
 
    if isinstance(p, bytes):
1041
 
        ps = re.split(b'[\\\\/]', p)
 
1038
    if os.path.sep == '\\':
 
1039
        # split on either delimiter because people might use either on
 
1040
        # Windows
 
1041
        if isinstance(p, bytes):
 
1042
            ps = re.split(b'[\\\\/]', p)
 
1043
        else:
 
1044
            ps = re.split(r'[\\/]', p)
1042
1045
    else:
1043
 
        ps = re.split(r'[\\/]', p)
 
1046
        if isinstance(p, bytes):
 
1047
            ps = p.split(b'/')
 
1048
        else:
 
1049
            ps = p.split('/')
1044
1050
 
1045
1051
    rps = []
1046
1052
    for f in ps: