normalize-path ( path -- path' )
Factor handbook » Input and output » Pathnames

Prev:append-path ( path1 path2 -- path )
Next:absolute-path ( path -- path' )


Vocabulary
io.backend

Inputs
patha pathname string


Outputs
path'a new pathname string


Word description
Prepends the current-directory to the pathname, resolves a resource: or vocab: prefix, if present (see Special pathnames). Also converts the path into a UNC path on Windows.

Notes
High-level words, such as <file-reader> and delete-file call this word for you. It only needs to be called directly when passing pathnames to C functions or external processes. This is because Factor does not use the operating system's notion of a current directory, and instead maintains its own dynamically-scoped current-directory variable.

Notes
On Windows NT platforms, this word prepends the Unicode path prefix.

Examples
For example, if you create a file named data.txt in the current directory, and wish to pass it to a process, you must normalize it:
"1 2 3" "data.txt" ascii set-file-contents "munge" "data.txt" normalize-path 2array run-process


Definition


Methods