Update to PathTools-3.22.
authorSteve Peters <steve@fisharerojo.org>
Tue, 10 Oct 2006 14:05:52 +0000 (14:05 +0000)
committerSteve Peters <steve@fisharerojo.org>
Tue, 10 Oct 2006 14:05:52 +0000 (14:05 +0000)
p4raw-id: //depot/perl@28983

ext/Cwd/Changes
ext/Text/Soundex/Soundex.xs
lib/Cwd.pm
lib/File/Spec.pm
lib/File/Spec/Unix.pm
lib/File/Spec/t/Spec.t
lib/File/Spec/t/crossplatform.t

index 34c6fc5..9fb4260 100644 (file)
@@ -1,6 +1,11 @@
 Revision history for Perl distribution PathTools.
 
-3.21  Wed Oct  4 21:13:21 CDT 2006
+
+ - Fixed the t/crossplatform.t test on Win32 (and possibly other
+   volume-aware platforms) now that rel2abs() always adds a drive
+   letter. [Reported by several parties]
+
+3.21 - Wed Oct  4 21:16:43 2006
 
  - Added a bunch of X<> tags to the File::Spec docs to help
    podindex. [Gabor Szabo]
index 9f5d809..6ca8d34 100644 (file)
@@ -25,8 +25,7 @@ static char *soundex_table =
   /*ABCDEFGHIJKLMNOPQRSTUVWXYZ*/
    "01230120022455012623010202";
 
-static SV *sv_soundex (source)
-     SV *source;
+static SV *sv_soundex (SV *source)
 {
   char *source_p;
   char *source_end;
@@ -77,8 +76,7 @@ static SV *sv_soundex (source)
   return SvREFCNT_inc(perl_get_sv("Text::Soundex::nocode", FALSE));
 }
 
-static SV *sv_soundex_utf8 (source)
-     SV *source;
+static SV *sv_soundex_utf8 (SV* source)
 {
   U8 *source_p;
   U8 *source_end;
index 1a1fd60..fa5948c 100644 (file)
@@ -171,7 +171,7 @@ use strict;
 use Exporter;
 use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
 
-$VERSION = '3.21';
+$VERSION = '3.22';
 
 @ISA = qw/ Exporter /;
 @EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
index df1549c..f0e0844 100644 (file)
@@ -3,7 +3,7 @@ package File::Spec;
 use strict;
 use vars qw(@ISA $VERSION);
 
-$VERSION = '3.21';
+$VERSION = '3.22';
 $VERSION = eval $VERSION;
 
 my %module = (MacOS   => 'Mac',
index 18f7652..6cec757 100644 (file)
@@ -356,14 +356,14 @@ sub abs2rel {
     my($self,$path,$base) = @_;
     $base = $self->_cwd() unless defined $base and length $base;
 
-    for ($path, $base) { $_ = $self->canonpath($_) }
+    ($path, $base) = map $self->canonpath($_), $path, $base;
 
     if (grep $self->file_name_is_absolute($_), $path, $base) {
-       for ($path, $base) { $_ = $self->rel2abs($_) }
+       ($path, $base) = map $self->rel2abs($_), $path, $base;
     }
     else {
        # save a couple of cwd()s if both paths are relative
-       for ($path, $base) { $_ = $self->catdir('/', $_) }
+       ($path, $base) = map $self->catdir('/', $_), $path, $base;
     }
 
     my ($path_volume) = $self->splitpath($path, 1);
index 32fdb39..f33efdd 100644 (file)
@@ -266,6 +266,7 @@ if ($^O eq 'MacOS') {
 [ "FakeWin32->abs2rel('C:\\Windows\\System32', 'C:\\')",  'Windows\System32'  ],
 [ "FakeWin32->abs2rel('\\\\computer2\\share3\\foo.txt', '\\\\computer2\\share3')",  'foo.txt' ],
 [ "FakeWin32->abs2rel('C:\\one\\two\\t\\asd1\\', 't\\asd\\')", '..\\asd1'     ],
+[ "FakeWin32->abs2rel('\\one\\two', 'A:\\foo')",     'C:\\one\\two'           ],
 
 [ "FakeWin32->rel2abs('temp','C:/')",                       'C:\\temp'                        ],
 [ "FakeWin32->rel2abs('temp','C:/a')",                      'C:\\a\\temp'                     ],
index 2da585e..0391aaa 100644 (file)
@@ -39,14 +39,16 @@ foreach my $platform (@platforms) {
     my $v = $volumes{$platform} || '';
     my $other_v = $other_vols{$platform} || '';
     
-    # Fake out the rootdir on MacOS
+    # Fake out the environment on MacOS and Win32
     no strict 'refs';
     my $save_w = $^W;
     $^W = 0;
     local *{"File::Spec::Mac::rootdir"} = sub { "Macintosh HD:" };
+    local *{"File::Spec::Win32::_cwd"}  = sub { "C:\\foo" };
     $^W = $save_w;
     use strict 'refs';
-    
+
+
     my ($file, $base, $result);
 
     $base = $module->catpath($v, $module->catdir('', 'foo'), '');
@@ -71,15 +73,15 @@ foreach my $platform (@platforms) {
     $result = volumes_differ($module, $file, $base) ? $file : $module->catfile('bar', 'file');
     is $module->abs2rel($file, $base), $result, "$platform->abs2rel($file, $base)";
 
-    # abs2rel('/foo/bar', 'A:/foo')    ->  '/foo/bar'
+    # abs2rel('/foo/bar/file', 'A:/foo')    ->  '/foo/bar'
     $file = $module->catpath('', $module->catdir($module->rootdir, 'foo', 'bar'), 'file');
     $base = $module->catpath($v, $module->catdir($module->rootdir, 'foo'), '');
-    $result = volumes_differ($module, $file, $base) ? $file : $module->catfile('bar', 'file');
+    $result = volumes_differ($module, $file, $base) ? $module->rel2abs($file) : $module->catfile('bar', 'file');
     is $module->abs2rel($file, $base), $result, "$platform->abs2rel($file, $base)";
     
     # abs2rel('/foo/bar', 'B:/foo')    ->  '/foo/bar'
     $base = $module->catpath($other_v, $module->catdir($module->rootdir, 'foo'), '');
-    $result = volumes_differ($module, $file, $base) ? $file : $module->catfile('bar', 'file');
+    $result = volumes_differ($module, $file, $base) ? $module->rel2abs($file) : $module->catfile('bar', 'file');
     is $module->abs2rel($file, $base), $result, "$platform->abs2rel($file, $base)";
     
     # abs2rel('/foo/bar', '/foo')      ->  'bar'