Expand description
Resolving paths the model writes: @ prefixes, ~, file://, odd spaces, and
the macOS screenshot and quote variants of existing files.
Functions§
- expand
- Expands
~andfile://URLs. - expand_
home ~and~/…name the home directory, as in a shell.- file_
url - Node’s
pathToFileURLfor an absolute path. - file_
url_ path - The local path a
file:URL names, the reverse offile_url, orNonefor 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, andfile://URLs become paths. - relative
- Node’s
path.relativefor absolute, lexically resolved paths: the steps fromfromtoto,""when they are the same. - resolve_
lexically - Lexically resolves
pathagainstbase: 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.