File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,25 @@ and are allowed to contain path separators.
51
51
IO::Spec::Cygwin.catdir(<foo/bar ber perl>).say;
52
52
# OUTPUT: «foo/bar/ber/perl»
53
53
54
+ = head2 method catpath
55
+
56
+ method catpath (Str:D $volume, Str:D $dirs, Str:D $file --> Str:D)
57
+
58
+ Same as L « C < IO::Spec::Win32.catpath > |/type/IO::Spec::Win32#method_catpath» ,
59
+ except will also change all backslashes to slashes at the end:
60
+
61
+ IO::Spec::Cygwin.catpath('C:', '/some/dir', 'foo.txt').say;
62
+ # OUTPUT: «C:/some/dir/foo.txt»
63
+
64
+ IO::Spec::Cygwin.catpath('C:', '/some/dir', '').say;
65
+ # OUTPUT: «C:/some/dir»
66
+
67
+ IO::Spec::Cygwin.catpath('', '/some/dir', 'foo.txt').say;
68
+ # OUTPUT: «/some/dir/foo.txt»
69
+
70
+ IO::Spec::Cygwin.catpath('E:', '', 'foo.txt').say;
71
+ # OUTPUT: «E:foo.txt»
72
+
54
73
= head2 method tmpdir
55
74
56
75
Defined as:
Original file line number Diff line number Diff line change @@ -64,6 +64,18 @@ and are allowed to contain path separators.
64
64
65
65
Alias for L « C < catdir > |/routine/catdir» .
66
66
67
+ = head2 method catpath
68
+
69
+ method catpath ($, Str:D $part1, Str:D $part2 --> Str:D)
70
+
71
+ Takes two path fragments and concatenates them, adding or removing a path
72
+ separator, if necessary. The first argument is ignored (it exists to maintain
73
+ consistent interface with other C < IO::Spec > types for systems that have
74
+ volumes).
75
+
76
+ IO::Spec::Unix.catpath($, 'some/dir', 'and/more').say;
77
+ # OUTPUT: «some/dir/and/more»
78
+
67
79
= head2 method tmpdir
68
80
69
81
Defined as:
Original file line number Diff line number Diff line change @@ -60,6 +60,27 @@ and are allowed to contain path separators.
60
60
61
61
Alias for L « C < catdir > |/routine/catdir» .
62
62
63
+ = head2 method catpath
64
+
65
+ method catpath (Str:D $volume, Str:D $dirs, Str:D $file --> Str:D)
66
+
67
+ Concatenates a path from given volume, a chain of directories, and file.
68
+ An empty string can be given for any of the three arguments. No attempt to
69
+ make the path cannonical is made. Use L « C < canonpath > |/routine/canonpath» for
70
+ that purpose.
71
+
72
+ IO::Spec::Win32.catpath('C:', '/some/dir', 'foo.txt').say;
73
+ # OUTPUT: «C:/some/dir\and/more»
74
+
75
+ IO::Spec::Win32.catpath('C:', '/some/dir', '').say;
76
+ # OUTPUT: «C:/some/dir»
77
+
78
+ IO::Spec::Win32.catpath('', '/some/dir', 'foo.txt').say;
79
+ # OUTPUT: «/some/dir\foo.txt»
80
+
81
+ IO::Spec::Win32.catpath('E:', '', 'foo.txt').say;
82
+ # OUTPUT: «E:foo.txt»
83
+
63
84
= head2 method tmpdir
64
85
65
86
Defined as:
You can’t perform that action at this time.
0 commit comments