diff options
-rw-r--r-- | ext/Cwd/Changes | 7 | ||||
-rw-r--r-- | ext/Text/Soundex/Soundex.xs | 6 | ||||
-rw-r--r-- | lib/Cwd.pm | 2 | ||||
-rw-r--r-- | lib/File/Spec.pm | 2 | ||||
-rw-r--r-- | lib/File/Spec/Unix.pm | 6 | ||||
-rw-r--r-- | lib/File/Spec/t/Spec.t | 1 | ||||
-rw-r--r-- | lib/File/Spec/t/crossplatform.t | 12 |
7 files changed, 21 insertions, 15 deletions
diff --git a/ext/Cwd/Changes b/ext/Cwd/Changes index 34c6fc568e..9fb4260489 100644 --- a/ext/Cwd/Changes +++ b/ext/Cwd/Changes @@ -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] diff --git a/ext/Text/Soundex/Soundex.xs b/ext/Text/Soundex/Soundex.xs index 9f5d809441..6ca8d3406b 100644 --- a/ext/Text/Soundex/Soundex.xs +++ b/ext/Text/Soundex/Soundex.xs @@ -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; diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 1a1fd60877..fa5948c436 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -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); diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm index df1549c5e2..f0e0844672 100644 --- a/lib/File/Spec.pm +++ b/lib/File/Spec.pm @@ -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', diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm index 18f7652085..6cec7577aa 100644 --- a/lib/File/Spec/Unix.pm +++ b/lib/File/Spec/Unix.pm @@ -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); diff --git a/lib/File/Spec/t/Spec.t b/lib/File/Spec/t/Spec.t index 32fdb39981..f33efdd926 100644 --- a/lib/File/Spec/t/Spec.t +++ b/lib/File/Spec/t/Spec.t @@ -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' ], diff --git a/lib/File/Spec/t/crossplatform.t b/lib/File/Spec/t/crossplatform.t index 2da585ec54..0391aaacff 100644 --- a/lib/File/Spec/t/crossplatform.t +++ b/lib/File/Spec/t/crossplatform.t @@ -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' |