relative_posix_path
- glotaran.utils.io.relative_posix_path(source_path: StrOrPath, base_path: StrOrPath | None = None) str [source]
Ensure that
source_path
is a posix path, relative tobase_path
if defined.For
source_path
to be converted to a relative path it either needs to a an absolute path orbase_path
needs to be a parent directory ofsource_path
. On Windows ifsource_path
andbase_path
are on different drives, it will return the absolute posix path to the file.- Parameters:
source_path (StrOrPath) – Path which should be converted to a relative posix path.
base_path (StrOrPath, optional) – Base path the resulting path string should be relative to. Defaults to
None
.
- Returns:
source_path
as posix path relative tobase_path
if defined.- Return type: