diff options
-rw-r--r-- | lib/File/Spec/Unix.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm index 8be7329ffe..fc20200503 100644 --- a/lib/File/Spec/Unix.pm +++ b/lib/File/Spec/Unix.pm @@ -364,7 +364,13 @@ sub abs2rel { # Can't relativize across volumes return $path unless $path_volume eq $base_volume; - for ($path, $base) { $_ = $self->rel2abs($_) } + if (grep $self->file_name_is_absolute($_), $path, $base) { + for ($path, $base) { $_ = $self->rel2abs($_) } + } + else { + # save a couple of cwd()s if both paths are relative + for ($path, $base) { $_ = $self->catdir('/', $_) } + } my $path_directories = ($self->splitpath($path, 1))[1]; my $base_directories = ($self->splitpath($base, 1))[1]; |