The canonpath routine

Combined from primary sources listed below.

In class IO::Spec::QNX ( Type/IO/Spec/QNX )§

See primary docmentation in context for method canonpath.

method canonpath§

method canonpath(Str() $path, :$parent --> Str:D)

Returns a string that is a canonical representation of $path. If :$parent is set to true, will also clean up references to parent directories. NOTE: the routine does not access the filesystem, so no symlinks are followed.

IO::Spec::QNX.canonpath("foo//../bar/../ber").say;
# OUTPUT: «foo/../bar/../ber␤»

IO::Spec::QNX.canonpath("foo///./../bar/../ber").say;
# OUTPUT: «foo/../bar/../ber␤»

IO::Spec::QNX.canonpath("foo///./../bar/../ber", :parent).say;
# OUTPUT: «ber␤»

In class IO::Spec::Unix ( Type/IO/Spec/Unix )§

See primary docmentation in context for method canonpath.

method canonpath§

method canonpath(Str() $path, :$parent --> Str:D)

Returns a string that is a canonical representation of $path. If :$parent is set to true, will also clean up references to parent directories. NOTE: the routine does not access the filesystem, so no symlinks are followed.

IO::Spec::Unix.canonpath("foo//../bar/../ber").say;
# OUTPUT: «foo/../bar/../ber␤»

IO::Spec::Unix.canonpath("foo///./../bar/../ber").say;
# OUTPUT: «foo/../bar/../ber␤»

IO::Spec::Unix.canonpath("foo///./../bar/../ber", :parent).say;
# OUTPUT: «ber␤»

In class IO::Spec::Win32 ( Type/IO/Spec/Win32 )§

See primary docmentation in context for method canonpath.

method canonpath§

method canonpath(Str() $path, :$parent --> Str:D)

Returns a string that is a canonical representation of $path. If :$parent is set to true, will also clean up references to parent directories. NOTE: the routine does not access the filesystem.

IO::Spec::Win32.canonpath("C:/foo//../bar/../ber").say;
# OUTPUT: «C:\foo\..\bar\..\ber␤»

IO::Spec::Win32.canonpath("C:/foo///./../bar/../ber").say;
# OUTPUT: «C:\foo\..\bar\..\ber␤»

IO::Spec::Win32.canonpath("C:/foo///./../bar/../ber", :parent).say;
# OUTPUT: «C:\ber␤»

In class IO::Spec::Cygwin ( Type/IO/Spec/Cygwin )§

See primary docmentation in context for method canonpath.

method canonpath§

method canonpath(Str() $path, :$parent --> Str:D)

Returns a string that is a canonical representation of $path. If :$parent is set to true, will also clean up references to parent directories. NOTE: the routine does not access the filesystem.

IO::Spec::Cygwin.canonpath(C:\foo\\..\bar\..\ber).say;
# OUTPUT: «C:/foo/../bar/../ber␤»

IO::Spec::Cygwin.canonpath("foo///./../bar/../ber").say;
# OUTPUT: «foo/../bar/../ber␤»

IO::Spec::Cygwin.canonpath("foo///./../bar/../ber", :parent).say;
# OUTPUT: «ber␤»