summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-31 18:36:24 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-31 18:36:24 +0000
commit4ffa161021ef4153827d85743ff391e5d86446bc (patch)
tree13be1e53a905658ac6869d443efef6df5717da33
parent319cef53be1e4f9b9d5f4c92c429de1b9c0b0640 (diff)
downloadperl-4ffa161021ef4153827d85743ff391e5d86446bc.tar.gz
Integrate change #9491 from maintperl into mainline.
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..)
-rw-r--r--lib/Cwd.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm
index 385f9723b7..ecf57a2543 100644
--- a/lib/Cwd.pm
+++ b/lib/Cwd.pm
@@ -170,7 +170,14 @@ sub chdir {
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'}
}
@@ -178,7 +185,7 @@ sub chdir {
return $ENV{'PWD'} = cwd();
}
elsif ($^O eq 'MSWin32') {
- $ENV{'PWD'} = Win32::GetFullPathName($newdir);
+ $ENV{'PWD'} = $newpwd;
return 1;
}