Handbook
Glossary
canonicalize-path* ( path -- path' )
Vocabulary
io
.
pathnames
Inputs
path
an
object
Outputs
path'
an
object
Definition
USING:
kernel
sequences
splitting
;
IN:
io.pathnames
:
canonicalize-path*
( path -- path' )
[
relative-path
[
path-separator?
]
split-when
[
{
"."
""
}
member?
]
reject
V{
}
clone
[
dup
".."
=
[
over
empty?
[
over
push
]
[
over
?last
".."
=
[
over
push
]
[
drop
dup
pop*
]
if
]
if
]
[
over
push
]
if
]
reduce
]
keep
dup
absolute-path?
[
[
[
".."
=
]
trim-head
cross-platform-path-separator
join
]
dip
root-path
prepend-path
]
[
drop
cross-platform-path-separator
join
[
"."
]
when-empty
]
if
;