Cwd::chdir() doesn't set $ENV{PWD} correctly on windows when the
directory is relative (need to fetch the full path name *before*
the chdir!)
p4raw-link: @9491 on //depot/maint-5.6/perl:
8719091e80cabf1226d64033edd75847e717d618
p4raw-id: //depot/perl@9492
p4raw-integrated: from //depot/maint-5.6/perl@9490 'merge in'
lib/Cwd.pm (@9279..)
my $newdir = @_ ? shift : ''; # allow for no arg (chdir to HOME dir)
$newdir =~ s|///*|/|g unless $^O eq 'MSWin32';
chdir_init() unless $chdir_init;
+ my $newpwd;
+ if ($^O eq 'MSWin32') {
+ # get the full path name *before* the chdir()
+ $newpwd = Win32::GetFullPathName($newdir);
+ }
+
return 0 unless CORE::chdir $newdir;
+
if ($^O eq 'VMS') {
return $ENV{'PWD'} = $ENV{'DEFAULT'}
}
return $ENV{'PWD'} = cwd();
}
elsif ($^O eq 'MSWin32') {
- $ENV{'PWD'} = Win32::GetFullPathName($newdir);
+ $ENV{'PWD'} = $newpwd;
return 1;
}