예제 #1
0
def _getfullpathname(space, w_path):
    """helper for ntpath.abspath """
    try:
        if space.isinstance_w(w_path, space.w_unicode):
            path = FileEncoder(space, w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
        else:
            path = space.str0_w(w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
    except OSError, e:
        raise wrap_oserror2(space, e, w_path)
예제 #2
0
def _getfullpathname(space, w_path):
    """helper for ntpath.abspath """
    try:
        if space.isinstance_w(w_path, space.w_unicode):
            path = FileEncoder(space, w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
        else:
            path = space.str0_w(w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
    except OSError, e:
        raise wrap_oserror2(space, e, w_path)
예제 #3
0
def _getfullpathname(space, w_path):
    """helper for ntpath.abspath """
    try:
        if space.isinstance_w(w_path, space.w_unicode):
            path = FileEncoder(space, w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = u2utf8(space, fullpath)
        else:
            path = space.bytes0_w(w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.newbytes(fullpath)
    except OSError as e:
        raise wrap_oserror2(space, e, w_path)
    else:
        return w_fullpath
예제 #4
0
파일: rpath.py 프로젝트: sota/pypy-old
def _nt_rabspath(path):
    try:
        if path == '':
            path = os.getcwd()
        return rposix.getfullpathname(path)
    except OSError:
        return path
예제 #5
0
파일: rpath.py 프로젝트: abhinavthomas/pypy
def _nt_rabspath(path):
    try:
        if path == '':
            path = os.getcwd()
        return rposix.getfullpathname(path)
    except OSError:
        return path
예제 #6
0
 def test__getfullpathname(self):
     posix = __import__(os.name)
     sysdrv = os.getenv('SystemDrive', 'C:')
     stuff = sysdrv + 'stuff'
     data = rposix.getfullpathname(stuff)
     assert data == posix._getfullpathname(stuff)
     # the most intriguing failure of ntpath.py should not repeat, here:
     assert not data.endswith(stuff)
예제 #7
0
 def test__getfullpathname(self):
     posix = __import__(os.name)
     sysdrv = os.getenv('SystemDrive', 'C:')
     stuff = sysdrv + 'stuff'
     data = rposix.getfullpathname(stuff)
     assert data == posix._getfullpathname(stuff)
     # the most intriguing failure of ntpath.py should not repeat, here:
     assert not data.endswith(stuff)
예제 #8
0
 def test__getfullpathname_long(self):
     stuff = "C:" + "\\abcd" * 100
     py.test.raises(WindowsError, rposix.getfullpathname, stuff)
     ustuff = u"C:" + u"\\abcd" * 100
     res = rposix.getfullpathname(ustuff)
     assert res == ustuff