def relto(self, relpath): |
""" return a string which is the relative part of the path |
to the given 'relpath'. |
""" |
if not isinstance(relpath, (str, PathBase)): |
raise TypeError("%r: not a string or path object" %(relpath,)) |
strrelpath = str(relpath) |
if strrelpath and strrelpath[-1] != self.sep: |
strrelpath += self.sep |
|
|
-> strself = str(self) |
if strself.startswith(strrelpath): |
return strself[len(strrelpath):] |
return "" |