splitpath
ErrorsCollection

splitpath

Synthesised documentation from type/IO/Spec/Cygwin type/IO/Spec/Win32 type/IO/Spec/Unix

From type/IO/Spec/Cygwin

See Original text in context

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

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

From type/IO/Spec/Win32

See Original text in context

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: «("", "", "")␤» 

From type/IO/Spec/Unix

See Original text in context

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: «("", "", "")␤»