(target: Path, current: Path)
return target
Get the path to target from current
Get the path to target from current
Get the path to target from current
def get_relative_path(target: Path, current: Path) -> Path:
    """Get the path to target from current"""
    # Go up "current" until we find a common ancestor to target
    acc = ['.']
    for part in [current, *current.parents]:
        try:
            path = target.relative_to(part)
            return Path(*acc, path)
        except ValueError:
            pass
        acc += ['..']

    # we failed, should not get here
    return target
def get_relative_path ( target : Path , current : Path ) -> Path : # Go up "current" until we find a common ancestor to target acc = [ '.' ] for part in [ current , * current . parents ] : try : path = target . relative_to ( part ) return Path ( * acc , path ) except ValueError : pass acc += [ '..' ] # we failed, should not get here return target