File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ In readlink, prefer the display path to the substitute path.
Original file line number Diff line number Diff line change 7979 from typing_extensions import Literal
8080
8181from . import classes , masks , matchers
82- from .compat .py38 import removesuffix
82+ from .compat .py38 import removeprefix , removesuffix
8383
8484__all__ = ['Path' , 'TempDir' ]
8585
@@ -1492,7 +1492,7 @@ def readlink(self):
14921492
14931493 .. seealso:: :meth:`readlinkabs`, :func:`os.readlink`
14941494 """
1495- return self ._next_class (os .readlink (self ))
1495+ return self ._next_class (removeprefix ( os .readlink (self ), ' \\ \\ ? \\ ' ))
14961496
14971497 def readlinkabs (self ):
14981498 """Return the path to which this symbolic link points.
Original file line number Diff line number Diff line change @@ -8,7 +8,16 @@ def removesuffix(self, suffix):
88 return self [: - len (suffix )]
99 else :
1010 return self [:]
11+
12+ def removeprefix (self , prefix ):
13+ if self .startswith (prefix ):
14+ return self [len (prefix ) :]
15+ else :
16+ return self [:]
1117else :
1218
1319 def removesuffix (self , suffix ):
1420 return self .removesuffix (suffix )
21+
22+ def removeprefix (self , prefix ):
23+ return self .removeprefix (prefix )
You can’t perform that action at this time.
0 commit comments