method rel2abs

Documentation for method rel2abs assembled from the following types:

class IO::Spec::Cygwin

From IO::Spec::Cygwin

(IO::Spec::Cygwin) method rel2abs

Defined as:

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

Same as IO::Spec::Win32.rel2abs, except replaces backslashes with slashes in the final result.

class IO::Spec::Unix

From IO::Spec::Unix

(IO::Spec::Unix) method rel2abs

Defined as:

method rel2abs(Str() $path$base = $*CWD --> Str:D)

Returns a string representing $path converted to absolute path, based at $base, which defaults to $*CWD. If $base is not an absolute path, it will be made absolute relative to $*CWD, unless $*CWD and $base are the same.

say $*CWD;                                  # OUTPUT: «"/home/camelia".IO␤» 
 
say IO::Spec::Unix.rel2abs: 'foo';          # OUTPUT: «/home/camelia/foo␤» 
say IO::Spec::Unix.rel2abs: './';           # OUTPUT: «/home/camelia␤» 
say IO::Spec::Unix.rel2abs: 'foo/../../';   # OUTPUT: «/home/camelia/foo/../..␤» 
say IO::Spec::Unix.rel2abs: '/foo/';        # OUTPUT: «/foo␤» 
 
say IO::Spec::Unix.rel2abs: 'foo''bar';   # OUTPUT: «/home/camelia/bar/foo␤» 
say IO::Spec::Unix.rel2abs: './''/bar';   # OUTPUT: «/bar␤» 
say IO::Spec::Unix.rel2abs: '/foo/''bar'# OUTPUT: «/foo␤» 
 
say IO::Spec::Unix.rel2abs: 'foo/../../''bar';
# OUTPUT: «/home/camelia/bar/foo/../..␤» 

class IO::Spec::Win32

From IO::Spec::Win32

(IO::Spec::Win32) method rel2abs

Defined as:

method rel2abs(Str() $path$base = $*CWD --> Str:D)

Returns a string representing $path converted to absolute path, based at $base, which defaults to $*CWD. If $base is not an absolute path, it will be made absolute relative to $*CWD, unless $*CWD and $base are the same.

say $*CWD;                                   # OUTPUT: «"C:\Users\camelia".IO␤» 
 
say IO::Spec::Win32.rel2abs: 'foo';          # OUTPUT: «C:\Users\camelia\foo␤» 
say IO::Spec::Win32.rel2abs: './';           # OUTPUT: «C:\Users\camelia␤» 
say IO::Spec::Win32.rel2abs: 'foo/../../';   # OUTPUT: «C:\Users\camelia\foo\..\..␤» 
say IO::Spec::Win32.rel2abs: '/foo/';        # OUTPUT: «C:\foo␤» 
 
say IO::Spec::Win32.rel2abs: 'foo''bar';   # OUTPUT: «C:\Users\camelia\bar\foo␤» 
say IO::Spec::Win32.rel2abs: './''/bar';   # OUTPUT: «\bar␤» 
say IO::Spec::Win32.rel2abs: '/foo/''bar'# OUTPUT: «C:\foo␤» 
 
say IO::Spec::Win32.rel2abs: 'foo/../../''bar';
# OUTPUT: «C:\Users\camelia\bar\foo\..\..␤»