11<?php
22
3- define ( 'WP_CLI_BUNDLE_ROOT ' , dirname ( dirname ( __FILE__ ) ) );
3+ define ( 'WP_CLI_BUNDLE_ROOT ' , rtrim ( dirname ( dirname ( __FILE__ ) ), ' / ' ) );
44
55if ( file_exists ( WP_CLI_BUNDLE_ROOT . '/vendor/autoload.php ' ) ) {
66 define ( 'WP_CLI_BASE_PATH ' , WP_CLI_BUNDLE_ROOT );
1313 exit (1 );
1414}
1515
16- define ( 'WP_CLI_ROOT ' , WP_CLI_VENDOR_DIR . '/wp-cli/wp-cli ' );
16+ define ( 'WP_CLI_ROOT ' , rtrim ( WP_CLI_VENDOR_DIR , ' / ' ) . '/wp-cli/wp-cli ' );
1717
1818require WP_CLI_VENDOR_DIR . '/autoload.php ' ;
1919require WP_CLI_ROOT . '/php/utils.php ' ;
@@ -233,7 +233,7 @@ function get_composer_versions( $current_version ) {
233233
234234if ( 'cli ' !== BUILD ) {
235235 // Include base project files, because the autoloader will load them
236- if ( WP_CLI_BASE_PATH !== WP_CLI_BUNDLE_ROOT ) {
236+ if ( WP_CLI_BASE_PATH !== WP_CLI_BUNDLE_ROOT && is_dir ( WP_CLI_BASE_PATH . ' /src ' ) ) {
237237 $ finder = new Finder ();
238238 $ finder
239239 ->files ()
@@ -287,6 +287,7 @@ function get_composer_versions( $current_version ) {
287287set_file_contents ( $ phar , WP_CLI_ROOT . '/VERSION ' , $ current_version );
288288
289289$ phar_boot = str_replace ( WP_CLI_BASE_PATH , '' , WP_CLI_BUNDLE_ROOT . '/php/boot-phar.php ' );
290+ $ phar_boot = '/ ' . ltrim ( $ phar_boot , '/ ' );
290291$ phar ->setStub ( <<<EOB
291292#!/usr/bin/env php
292293<?php
@@ -302,5 +303,5 @@ function get_composer_versions( $current_version ) {
302303chmod ( DEST_PATH , 0755 ); // Make executable.
303304
304305if ( ! BE_QUIET ) {
305- echo " Generated " . DEST_PATH . PHP_EOL ;
306+ echo ' Generated ' . DEST_PATH . PHP_EOL ;
306307}
0 commit comments