Revision history for Perl distribution PathTools.
+ - Yet more Win32 fixes (sigh... seems like I'm fighting a neverending
+ waterbed...). This time, fixed file_name_is_absolute() to know
+ what it's doing when the path includes a volume but a relative
+ path, like C:foo.txt . This bug had impact in rel2abs() on Win32
+ too.
+
+3.22 - Mon Oct 9 21:50:52 2006
- Fixed the t/crossplatform.t test on Win32 (and possibly other
volume-aware platforms) now that rel2abs() always adds a drive
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
-$VERSION = '3.22';
+$VERSION = '3.23';
@ISA = qw/ Exporter /;
@EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.22';
+$VERSION = '3.23';
$VERSION = eval $VERSION;
my %module = (MacOS => 'Mac',
}
sub file_name_is_absolute {
+ # As of right now, this returns 2 if the path is absolute with a
+ # volume, 1 if it's absolute with no volume, 0 otherwise.
+
my ($self,$file) = @_;
- return $file =~ m{^$VOL_RX}os ? 2 :
- $file =~ m{^[\\/]}is ? 1 :
- 0;
+
+ if ($file =~ m{^($VOL_RX)}o) {
+ my $vol = $1;
+ return ($vol =~ m{^$UNC_RX}o ? 2
+ : $file =~ m{^$DRIVE_RX[\\/]}o ? 2
+ : 0);
+ }
+ return $file =~ m{^[\\/]} ? 1 : 0;
}
=item catfile
[ "FakeWin32->rel2abs('../temp','//prague_main/work/')", '\\\\prague_main\\work\\temp' ],
[ "FakeWin32->rel2abs('temp','//prague_main/work')", '\\\\prague_main\\work\\temp' ],
[ "FakeWin32->rel2abs('../','//prague_main/work')", '\\\\prague_main\\work' ],
+[ "FakeWin32->rel2abs('D:foo.txt')", 'D:\\alpha\\beta\\foo.txt' ],
[ "VMS->case_tolerant()", '1' ],
) ;
-if ($^O eq 'MSWin32') {
- push @tests, [ "FakeWin32->rel2abs('D:foo.txt')", 'D:\\alpha\\beta\\foo.txt' ];
-}
plan tests => scalar @tests;