real_rel_path

Contents

real_rel_path#

real_rel_path(raw_path: str | CloudPath | Path, start: str | CloudPath | Path) CloudPath | Path[source]#

Deprecated since version 1.30.0: Import it from sertit.path instead of sertit.files

Gives the real relative path from a starting folder. (and not just adding ../.. between the start and the target)

Parameters:
  • raw_path (AnyPathStrType) – Path to make relative

  • start (AnyPathStrType) – Start, the path being relative from this folder.

Returns:

Relative path

Example

>>> path = r'D:/_SERTIT_UTILS/sertit-utils/sertit'
>>> start = os.path.join(".", "..", "..")
>>> real_rel_path(path, start)
'sertit-utils/sertit'