/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/osutils.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 00:06:46 UTC
  • mfrom: (6673 work)
  • mto: This revision was merged to the branch mainline in revision 6675.
  • Revision ID: jelmer@jelmer.uk-20170610000646-xj6jh277lo4xuo10
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
375
375
    return _win32_fixdrive(ntpath.abspath(unicode(path)).replace('\\', '/'))
376
376
 
377
377
 
378
 
def _win98_abspath(path):
379
 
    """Return the absolute version of a path.
380
 
    Windows 98 safe implementation (python reimplementation
381
 
    of Win32 API function GetFullPathNameW)
382
 
    """
383
 
    # Corner cases:
384
 
    #   C:\path     => C:/path
385
 
    #   C:/path     => C:/path
386
 
    #   \\HOST\path => //HOST/path
387
 
    #   //HOST/path => //HOST/path
388
 
    #   path        => C:/cwd/path
389
 
    #   /path       => C:/path
390
 
    path = unicode(path)
391
 
    # check for absolute path
392
 
    drive = ntpath.splitdrive(path)[0]
393
 
    if drive == '' and path[:2] not in('//','\\\\'):
394
 
        cwd = _getcwd()
395
 
        # we cannot simply os.path.join cwd and path
396
 
        # because os.path.join('C:','/path') produce '/path'
397
 
        # and this is incorrect
398
 
        if path[:1] in ('/','\\'):
399
 
            cwd = ntpath.splitdrive(cwd)[0]
400
 
            path = path[1:]
401
 
        path = cwd + '\\' + path
402
 
    return _win32_fixdrive(ntpath.normpath(path).replace('\\', '/'))
403
 
 
404
 
 
405
378
def _win32_realpath(path):
406
379
    # Real ntpath.realpath doesn't have a problem with a unicode cwd
407
380
    return _win32_fixdrive(ntpath.realpath(unicode(path)).replace('\\', '/'))
503
476
 
504
477
 
505
478
if sys.platform == 'win32':
506
 
    if win32utils.winver == 'Windows 98':
507
 
        abspath = _win98_abspath
508
 
    else:
509
 
        abspath = _win32_abspath
 
479
    abspath = _win32_abspath
510
480
    realpath = _win32_realpath
511
481
    pathjoin = _win32_pathjoin
512
482
    normpath = _win32_normpath
1836
1806
    """
1837
1807
    global _selected_dir_reader
1838
1808
    if _selected_dir_reader is None:
1839
 
        if sys.platform == "win32" and win32utils.winver == 'Windows NT':
1840
 
            # Win98 doesn't have unicode apis like FindFirstFileW
1841
 
            # TODO: We possibly could support Win98 by falling back to the
1842
 
            #       original FindFirstFile, and using TCHAR instead of WCHAR,
1843
 
            #       but that gets a bit tricky, and requires custom compiling
1844
 
            #       for win98 anyway.
 
1809
        if sys.platform == "win32":
1845
1810
            try:
1846
1811
                from ._walkdirs_win32 import Win32ReadDir
1847
1812
                _selected_dir_reader = Win32ReadDir()