In IO::Spec::Win32§

See primary documentation in context for method splitpath

method splitpath(Cool:D $path:$nofile --> List:D)

Splits the given $path into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile named argument is set to True, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.

IO::Spec::Win32.splitpath('C:\foo/bar.txt').raku.say;
# OUTPUT: «("C:", "\\foo/", "bar.txt")␤» 
 
IO::Spec::Win32.splitpath('C:\foo/bar.txt':nofile).raku.say;
# OUTPUT: «("C:", "\\foo/bar.txt", "")␤» 
 
IO::Spec::Win32.splitpath('/foo/').raku.say;
# OUTPUT: «("", "/foo/", "")␤» 
 
IO::Spec::Win32.splitpath('/foo/':nofile).raku.say;
# OUTPUT: «("", "/foo/", "")␤» 
 
IO::Spec::Win32.splitpath('///').raku.say;
# OUTPUT: «("", "///", "")␤» 
 
IO::Spec::Win32.splitpath('./').raku.say;
# OUTPUT: «("", "./", "")␤» 
 
IO::Spec::Win32.splitpath('.').raku.say;
# OUTPUT: «("", "", ".")␤» 
 
IO::Spec::Win32.splitpath('').raku.say;
# OUTPUT: «("", "", "")␤» 

In IO::Spec::Cygwin§

See primary documentation in context for method splitpath

method splitpath(|c --> List:D)

Same as IO::Spec::Win32.splitpath, except replaces backslashes with slashes in all the values of the final result.

In IO::Spec::Unix§

See primary documentation in context for method splitpath

method splitpath(Cool:D $path:$nofile --> List:D)

Splits the given $path into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile named argument is set to True, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.

IO::Spec::Unix.splitpath('C:\foo/bar.txt').raku.say;
# OUTPUT: «("", "C:\\foo/", "bar.txt")␤» 
 
IO::Spec::Unix.splitpath('C:\foo/bar.txt':nofile).raku.say;
# OUTPUT: «("", "C:\\foo/bar.txt", "")␤» 
 
IO::Spec::Unix.splitpath('/foo/').raku.say;
# OUTPUT: «("", "/foo/", "")␤» 
 
IO::Spec::Unix.splitpath('/foo/':nofile).raku.say;
# OUTPUT: «("", "/foo/", "")␤» 
 
IO::Spec::Unix.splitpath('///').raku.say;
# OUTPUT: «("", "///", "")␤» 
 
IO::Spec::Unix.splitpath('./').raku.say;
# OUTPUT: «("", "./", "")␤» 
 
IO::Spec::Unix.splitpath('.').raku.say;
# OUTPUT: «("", "", ".")␤» 
 
IO::Spec::Unix.splitpath('').raku.say;
# OUTPUT: «("", "", "")␤»