resolve-symlinks ( path -- path' )
Factor documentation > Factor handbook > Input and output > Pathnames
Prev:absolute-path ( path -- path' )
Next:Pathname presentations


Vocabulary
io.pathnames

Inputs and outputs
patha pathname string
path'a new pathname string


Word description
Outputs a path where none of the path components are symlinks. This word is useful for determining the actual path on disk where a file is stored; the root of this absolute path is a mount point in the file-system.

Notes
Most code should not need to call this word except in very special circumstances. One use case is finding the actual file-system on which a file is stored.

Definition
USING: system ;

IN: io.pathnames

HOOK: resolve-symlinks os ( path -- path' )


Methods
USING: io.backend io.pathnames kernel ;

M: object resolve-symlinks normalize-path ;


USING: io.files io.files.links io.pathnames kernel sequences
system ;

M: unix resolve-symlinks
path-components "/"
[ append-path dup exists? [ follow-links ] when ] reduce ;