method catpath

Documentation for method catpath assembled from the following types:

class IO::Spec::Cygwin

From IO::Spec::Cygwin

(IO::Spec::Cygwin) method catpath

Defined as:

method catpath (Str:D $volumeStr:D $dirStr:D $file --> Str:D)

Same as IO::Spec::Win32.catpath, except will also change all backslashes to slashes at the end:

IO::Spec::Cygwin.catpath('C:''/some/dir''foo.txt').say;
# OUTPUT: «C:/some/dir/foo.txt␤» 
 
IO::Spec::Cygwin.catpath('C:''/some/dir''').say;
# OUTPUT: «C:/some/dir␤» 
 
IO::Spec::Cygwin.catpath('''/some/dir''foo.txt').say;
# OUTPUT: «/some/dir/foo.txt␤» 
 
IO::Spec::Cygwin.catpath('E:''''foo.txt').say;
# OUTPUT: «E:foo.txt␤»

class IO::Spec::Unix

From IO::Spec::Unix

(IO::Spec::Unix) method catpath

Defined as:

method catpath ($Str:D $part1Str:D $part2 --> Str:D)

Takes two path fragments and concatenates them, adding or removing a path separator, if necessary. The first argument is ignored (it exists to maintain consistent interface with other IO::Spec|/type/IO::Spec types for systems that have volumes).

IO::Spec::Unix.catpath($'some/dir''and/more').say;
# OUTPUT: «some/dir/and/more␤»

class IO::Spec::Win32

From IO::Spec::Win32

(IO::Spec::Win32) method catpath

Defined as:

method catpath (Str:D $volumeStr:D $dirStr:D $file --> Str:D)

Concatenates a path from given volume, a chain of directories, and file. An empty string can be given for any of the three arguments. No attempt to make the path canonical is made. Use canonpath for that purpose.

IO::Spec::Win32.catpath('C:''/some/dir''foo.txt').say;
# OUTPUT: «C:/some/dir\foo.txt␤» 
 
IO::Spec::Win32.catpath('C:''/some/dir''').say;
# OUTPUT: «C:/some/dir␤» 
 
IO::Spec::Win32.catpath('''/some/dir''foo.txt').say;
# OUTPUT: «/some/dir\foo.txt␤» 
 
IO::Spec::Win32.catpath('E:''''foo.txt').say;
# OUTPUT: «E:foo.txt␤»