Skip to content

Commit

Permalink
Merge pull request #3812 from iguessthislldo/igtd/windows-configure-s…
Browse files Browse the repository at this point in the history
…ubmodule-fix

Fix Configure Submodule Checkout on Windows
  • Loading branch information
simpsont-oci committed Oct 21, 2022
2 parents 07fc572 + c361a95 commit 4668bc2
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions configure
Expand Up @@ -398,15 +398,24 @@ my %specific =
'refpost' => '}', 'comment' => '#')
);

sub might_be_executable {
my $path = shift;
return -x $path && -f $path; # On Windows -x can return true for directories
}

sub which {
my $file = shift;
for my $p (File::Spec->path()) {
next if $p eq '.';
if (-x "$p/$file") {
return "$p/$file";
}
elsif ($exeext ne '' && -x "$p/$file$exeext") {
return "$p/$file$exeext";
my $path = "$p/$file";
if (might_be_executable($path)) {
return $path;
}
elsif ($exeext ne '') {
$path .= $exeext;
if (might_be_executable($path)) {
return $path;
}
}
}
return undef;
Expand Down Expand Up @@ -470,7 +479,7 @@ sub git_submodule_prop {
or die("git_submodule_prop open failed: $!\nStopped");
my $prop_value = <$fd>;
close($fd);
chomp($prop_value);
chomp($prop_value) if (defined($prop_value));
if (!$prop_value) {
die("Couldn't get $full_prop_name from .gitmodules\nStopped");
}
Expand Down

0 comments on commit 4668bc2

Please sign in to comment.