1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-16 06:25:03 -05:00

pathhelp.pm: fix use of pwd -L in Msys environment

While Msys2 has a pwd binary which supports -L,
Msys1 only has a shell built-in with that feature.

Reviewed-by: Jay Satiro

Part of #6179
This commit is contained in:
Marc Hoersken 2020-11-11 21:20:20 +01:00
parent 24f850f4a4
commit b2b3c91ed7
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E

View File

@ -372,7 +372,15 @@ sub sys_native_abs_path {
# Path is in relative form. Resolve relative directories in Unix form # Path is in relative form. Resolve relative directories in Unix form
# *BEFORE* converting to Win32 form otherwise paths like # *BEFORE* converting to Win32 form otherwise paths like
# '../../../cygdrive/c/windows' will not be resolved. # '../../../cygdrive/c/windows' will not be resolved.
my $cur_dir = `pwd -L`;
my $cur_dir;
# MSys shell has built-in command.
if($^O eq 'msys') {
$cur_dir = `bash -c 'pwd -L'`;
}
else {
$cur_dir = `pwd -L`;
}
if($? != 0) { if($? != 0) {
warn "Can't determine current working directory.\n"; warn "Can't determine current working directory.\n";
return undef; return undef;
@ -440,7 +448,13 @@ sub build_sys_abs_path {
# Path is empty string. Return current directory. # Path is empty string. Return current directory.
# Empty string processed correctly by 'cygpath'. # Empty string processed correctly by 'cygpath'.
# MSys shell has built-in command.
if($^O eq 'msys') {
chomp($path = `bash -c 'pwd -L'`);
}
else {
chomp($path = `pwd -L`); chomp($path = `pwd -L`);
}
if($? != 0) { if($? != 0) {
warn "Can't determine Unix-style current working directory.\n"; warn "Can't determine Unix-style current working directory.\n";
return undef; return undef;
@ -510,7 +524,15 @@ sub build_sys_abs_path {
# Path in relative form. Resolve relative directories in Unix form # Path in relative form. Resolve relative directories in Unix form
# *BEFORE* converting to Win32 form otherwise paths like # *BEFORE* converting to Win32 form otherwise paths like
# '../../../cygdrive/c/windows' will not be resolved. # '../../../cygdrive/c/windows' will not be resolved.
my $cur_dir = `pwd -L`;
my $cur_dir;
# MSys shell has built-in command.
if($^O eq 'msys') {
$cur_dir = `bash -c 'pwd -L'`;
}
else {
$cur_dir = `pwd -L`;
}
if($? != 0) { if($? != 0) {
warn "Can't determine current working directory.\n"; warn "Can't determine current working directory.\n";
return undef; return undef;