summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarrie Slaymaker <barries@slaysys.com>2001-11-12 06:19:52 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-12 15:26:37 +0000
commit9b1c7707319e7631584ef9f5d258edf5657d488c (patch)
tree4a7583d9edd53bea5603cc961937f1d386ce65f0
parentd1083c7a3c3dd1e1c3793d34739a88e8be554bc0 (diff)
downloadperl-9b1c7707319e7631584ef9f5d258edf5657d488c.tar.gz
remove volume from result
Message-ID: <20011112111948.C7626@sizzle.whoville.com> p4raw-id: //depot/perl@12957
-rwxr-xr-xlib/File/Spec.t5
-rw-r--r--lib/File/Spec/Win32.pm7
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/File/Spec.t b/lib/File/Spec.t
index 71a0b7abd1..306a131b34 100755
--- a/lib/File/Spec.t
+++ b/lib/File/Spec.t
@@ -196,6 +196,9 @@ if ($^O eq 'MacOS') {
[ "Win32->canonpath('//a/b/../../c')", '\\\\a\\b\\..\\..\\c' ],
[ "Win32->canonpath('//a/../../c')", '\\\\a\\..\\..\\c' ],
+## Hmmm, we should test missing and relative base paths some day...
+## would need to cd to a known place, get the cwd() and use it I
+## think.
[ "Win32->abs2rel('/t1/t2/t3','/t1/t2/t3')", '' ],
[ "Win32->abs2rel('/t1/t2/t4','/t1/t2/t3')", '..\\t4' ],
[ "Win32->abs2rel('/t1/t2','/t1/t2/t3')", '..' ],
@@ -208,6 +211,8 @@ if ($^O eq 'MacOS') {
[ "Win32->abs2rel('/./','/t1/t2/t3')", '..\\..\\..' ],
[ "Win32->abs2rel('\\\\a/t1/t2/t4','/t2/t3')", '..\\t4' ],
[ "Win32->abs2rel('//a/t1/t2/t4','/t2/t3')", '..\\t4' ],
+[ "Win32->abs2rel('A:/t1/t2/t3','B:/t1/t2/t3')",'' ],
+[ "Win32->abs2rel('A:/t1/t2/t3/t4','B:/t1/t2/t3')",'t4' ],
[ "Win32->rel2abs('temp','C:/')", 'C:\\temp' ],
[ "Win32->rel2abs('temp','C:/a')", 'C:\\a\\temp' ],
diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm
index d2e94bc98c..ceebb2d100 100644
--- a/lib/File/Spec/Win32.pm
+++ b/lib/File/Spec/Win32.pm
@@ -277,7 +277,7 @@ sub abs2rel {
}
# Split up paths
- my ( $path_volume, $path_directories, $path_file ) =
+ my ( undef, $path_directories, $path_file ) =
$self->splitpath( $path, 1 ) ;
my $base_directories = ($self->splitpath( $base, 1 ))[1] ;
@@ -315,11 +315,8 @@ sub abs2rel {
$path_directories = "$base_directories$path_directories" ;
}
- # It makes no sense to add a relative path to a UNC volume
- $path_volume = '' unless $path_volume =~ m{^[A-Z]:}is ;
-
return $self->canonpath(
- $self->catpath($path_volume, $path_directories, $path_file )
+ $self->catpath( "", $path_directories, $path_file )
) ;
}