Skip to content

Commit

Permalink
Auto mkdir folder when using command gen:swagger-schema. (#6473)
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo authored Jan 18, 2024
1 parent 2776915 commit 0e73770
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Command/GenSchemaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ public function handle()
$name = $ref->getShortName() . 'Schema';
}

$path = BASE_PATH . '/app/Schema/' . $name . '.php';
$dirname = BASE_PATH . '/app/Schema';
if (! is_dir($dirname)) {
mkdir($dirname, 0755, true);
}

$path = $dirname . '/' . $name . '.php';
if (file_exists($path) && ! $force) {
$this->output->error(sprintf('The path of schema %s is exists.', $path));
return;
Expand Down

0 comments on commit 0e73770

Please sign in to comment.