Skip to content

Commit

Permalink
Create multilevel folders
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Apr 1, 2024
1 parent b786c43 commit 9290dc1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Scaffold_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ private function get_output_path( $assoc_args, $subdir ) {
* default: circle
* options:
* - circle
* - bitbucket
* - gitlab
* - github
* ---
Expand Down Expand Up @@ -955,6 +954,12 @@ protected function create_files( $files_and_contents, $force ) {

$wp_filesystem->mkdir( dirname( $filename ) );

// Create multi-level folders.
if ( false === $wp_filesystem->exists( dirname( $filename ) ) ) {
$wp_filesystem->mkdir( dirname( dirname( $filename ) ) );
$wp_filesystem->mkdir( dirname( $filename ) );
}

if ( ! $wp_filesystem->put_contents( $filename, $contents ) ) {
WP_CLI::error( "Error creating file: {$filename}" );
} elseif ( $should_write_file ) {
Expand Down

0 comments on commit 9290dc1

Please sign in to comment.