See Original text in context
method splitpath(|c --> List)
Same as IO::Spec::Win32.splitpath
, except replaces backslashes with slashes in all the values of the final result.
See Original text in context
method splitpath(Cool , : --> List)
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: «("", "", "")»
See Original text in context
method splitpath(Cool , : --> List)
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: «("", "", "")»