~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

[merge] win32

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.trace import mutter
23
23
import bzrlib.errors as errors
24
24
import errno
 
25
import sys
25
26
 
26
27
_protocol_handlers = {
27
28
}
63
64
        if hasattr(e, 'errno'):
64
65
            if e.errno in (errno.ENOENT, errno.ENOTDIR):
65
66
                raise errors.NoSuchFile(path, extra=e)
 
67
            # I would rather use errno.EFOO, but there doesn't seem to be
 
68
            # any matching for 267
 
69
            # This is the error when doing a listdir on a file:
 
70
            # WindowsError: [Errno 267] The directory name is invalid
 
71
            if sys.platform == 'win32' and e.errno in (errno.ESRCH, 267):
 
72
                raise errors.NoSuchFile(path, extra=e)
66
73
            if e.errno == errno.EEXIST:
67
74
                raise errors.FileExists(path, extra=e)
68
75
            if e.errno == errno.EACCES:
370
377
    global _protocol_handlers
371
378
    if base is None:
372
379
        base = u'.'
 
380
    else:
 
381
        base = unicode(base)
373
382
    for proto, klass in _protocol_handlers.iteritems():
374
383
        if proto is not None and base.startswith(proto):
375
384
            return klass(base)