llm
Download
43 lines 1.1 KiBGroffModified 2026-09-01 raw
12345678910111213141516171819202122232425262728293031323334353637383940414243
'\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Path.relative_to 3 2026-09-01 "Tomo man-pages"
.SH NAME
Path.relative_to \- apply a relative path to another
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Path.relative_to\ :\ func(path:\ Path,\ relative_to:\ Path\ ->\ Path)
.fi
.SH DESCRIPTION
Returns the path relative to a given base path.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx
l l l.
Name	Type	Description
path	Path	The path to convert. 
relative_to	Path	The base path for the relative path. Unlike \fBPath.resolved\fR, this argument is required. 
.TE
.SH RETURN
A relative path from the reference point to the given path.

.SH NOTES
The result has no leading `./`, so a path naming something inside the base path cannot be written as a path literal. Results that climb out of the base path begin with `../` and can.

.SH EXAMPLES
.EX
# A path relative to itself is the current directory:
assert (/tmp).relative_to((/tmp)) == (.)
assert "$((./path/to/file.txt).relative_to((./path)))" == "to/file.txt"
assert "$((/tmp/foo).relative_to((/tmp)))" == "foo"
assert (/a/b/c).relative_to((/a/x)) == (../b/c)
.EE
.SH SEE ALSO
.BR Tomo-Path (3)