From 4ffa161021ef4153827d85743ff391e5d86446bc Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sat, 31 Mar 2001 18:36:24 +0000 Subject: [PATCH] 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..) --- lib/Cwd.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 385f972..ecf57a2 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; } -- 2.7.4