Skip to main content

Module path

Module path 

Source
Expand description

Resolving paths the model writes: @ prefixes, ~, file://, odd spaces, and the macOS screenshot and quote variants of existing files.

Functions§

expand
Expands ~ and file:// URLs.
expand_home
~ and ~/… name the home directory, as in a shell.
file_url
Node’s pathToFileURL for an absolute path.
file_url_path
The local path a file: URL names, the reverse of file_url, or None for any other URL.
home_dir
The user’s home directory, as Node’s os.homedir() finds it: HOME, even when empty, else the user database. / when neither has one.
normalize
Normalizes a path as pi does for tool input: Unicode spaces become spaces, a leading @ is dropped, ~ expands, and file:// URLs become paths.
relative
Node’s path.relative for absolute, lexically resolved paths: the steps from from to to, "" when they are the same.
resolve_lexically
Lexically resolves path against base: absolute result, no . or ...
resolve_read_path
Like resolve_to_cwd, but when the file does not exist, tries the variants pi tries: narrow no-break space before AM/PM, the decomposed Unicode form (NFD), curly apostrophes.
resolve_to_cwd
Resolves a tool path against the working directory.