File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change 8484
8585// find out full names of the executables
8686foreach ($ 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}
You can’t perform that action at this time.
0 commit comments