Skip to content

Commit 482f2bf

Browse files
Merge pull request #12 from wp-cli/9-relate-template-path-to-command
Use path relative to command to retrieve templates.
2 parents 1ad2040 + e8d4481 commit 482f2bf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Scaffold_Command.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -995,14 +995,13 @@ private static function mustache_render( $template, $data = array() ) {
995995
* Get template path based on installation type
996996
*/
997997
private static function get_template_path( $template ) {
998-
$template_path = WP_CLI_ROOT . '/vendor/wp-cli/scaffold-command/templates/' . $template;
998+
$command_root = Utils\phar_safe_path( dirname( __DIR__ ) );
999+
$template_path = "{$command_root}/templates/{$template}";
1000+
9991001
if ( ! file_exists( $template_path ) ) {
1000-
// scaffold command must've been built with vendor/wp-cli/wp-cli
1001-
$template_path = WP_CLI_ROOT . '/../../../templates/' . $template;
1002-
if ( ! file_exists( $template_path ) ) {
1003-
WP_CLI::error( "Couldn't find {$template}" );
1004-
}
1002+
WP_CLI::error( "Couldn't find {$template}" );
10051003
}
1004+
10061005
return $template_path;
10071006
}
10081007

0 commit comments

Comments
 (0)