Skip to content

Commit c4873af

Browse files
committed
Update fixpermissions.php to support public directory
1 parent c55daac commit c4873af

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

fixpermissions.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,30 @@
8484

8585
// find out full names of the executables
8686
foreach ($executables as $relname) {
87-
$realpath = realpath("$sourcedir/$relname");
88-
if ($realpath !== false) {
89-
$executables[$realpath] = $relname;
90-
} else {
91-
echo "Can not find real path for $relname in git repository\n";
92-
exit(1);
87+
// Possible paths for the executable.
88+
$paths = [
89+
"$sourcedir/$relname",
90+
"$sourcedir/public/$relname",
91+
];
92+
$patherrors = '';
93+
94+
foreach ($paths as $path) {
95+
$realpath = realpath($path);
96+
97+
if ($realpath === false) {
98+
$patherrors = "Can not find real path for $relname in git repository\n";
99+
} else if (!file_exists($realpath)) {
100+
$patherrors = "Can not find executable file $realpath in git repository\n";
101+
} else {
102+
// Set the executable pathname if it exists, we don't need to check any other paths.
103+
$executables[$realpath] = $relname;
104+
break;
105+
}
93106
}
94-
if (!file_exists($realpath)) {
95-
echo "Can not find executable file $realpath in git repository\n";
107+
108+
// Output errors if path not found.
109+
if (!isset($executables[$realpath])) {
110+
echo $patherrors;
96111
exit(1);
97112
}
98113
}

0 commit comments

Comments
 (0)