From: Gurusamy Sarathy Date: Wed, 2 Feb 2000 06:41:17 +0000 (+0000) Subject: fix broken abs2rel() (from François Allard ) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5cefc38b48b3e1ba030221debc31a0d0f7eeb90c;p=p5sagit%2Fp5-mst-13.2.git fix broken abs2rel() (from François Allard ) p4raw-id: //depot/perl@4949 --- diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm index 0ea4970..48ad847 100644 --- a/lib/File/Spec/Win32.pm +++ b/lib/File/Spec/Win32.pm @@ -309,14 +309,18 @@ sub abs2rel { $path_directories = CORE::join( '\\', @pathchunks ); $base_directories = CORE::join( '\\', @basechunks ); - # $base now contains the directories the resulting relative path - # must ascend out of before it can descend to $path_directory. So, + # $base_directories now contains the directories the resulting relative + # path must ascend out of before it can descend to $path_directory. So, # replace all names with $parentDir - $base_directories =~ s|[^/]+|..|g ; + + #FA Need to replace between backslashes... + $base_directories =~ s|[^\\]+|..|g ; # Glue the two together, using a separator if necessary, and preventing an # empty result. - if ( $path ne '' && $base ne '' ) { + + #FA Must check that new directories are not empty. + if ( $path_directories ne '' && $base_directories ne '' ) { $path_directories = "$base_directories\\$path_directories" ; } else { $path_directories = "$base_directories$path_directories" ;