Zum Inhalt springen

Filepath Relative

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Finds a relative path from a base path to a target path.

PortDescription
Base Path
The base path to measure from.
Target Path
The target path to measure to.
PortDescription
The relative path from basepath to targpath.

Calculates a relative path from basepath to targpath. The relative path is the path that, when joined to basepath, leads to targpath.

An error is returned if targpath cannot be made relative to basepath (e.g., they are on different volumes on Windows) or if the computation fails.

Path StyleBase PathTarget PathOutput
POSIX-style/a/b/c/a/b/c/d/ed/e
POSIX-style/a/b/c/a/b/d/e../d/e
POSIX-style/a/b/c/d../../c/d
Windows-styleC:\a\b\cC:\a\b\c\d\ed\e
Windows-styleC:\a\b\cC:\a\b\d\e..\d\e
Windows-styleC:\a\bD:\c\d(error)

ID: core/filepath-rel@v1