Documentation for method canonpath assembled from the following pages:

Class: IO::Spec::Cygwin §

From IO::Spec::Cygwin

(IO::Spec::Cygwin) method canonpath §

Defined as:

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␤»

Class: IO::Spec::QNX §

From IO::Spec::QNX

(IO::Spec::QNX) method canonpath §

Defined as:

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␤»

Class: IO::Spec::Unix §

From IO::Spec::Unix

(IO::Spec::Unix) method canonpath §

Defined as:

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␤»

Class: IO::Spec::Win32 §

From IO::Spec::Win32

(IO::Spec::Win32) method canonpath §

Defined as:

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␤»