For the complete documentation index, see llms.txt. This page is also available as Markdown.

ContractPath

Does the opposite of expandPath.

Tries to match a given absolute path to mappings in the environment and will return a path that is contracted by the shortest matched mapping. If there are no matches, returns the absolute path it was given.

Method Signature

ContractPath(path=[string])

Arguments

Argument
Type
Required
Description
Default

path

string

true

The absolute path to contract.

Examples

Contract a path relative to a base

base = getTempDirectory();
full = base & "subdir/file.txt";
result = contractPath( full, base );
writeOutput( result );

Result: subdir/file.txt

Last updated

Was this helpful?