mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-24 00:55:35 +08:00
fix init command dir
This commit is contained in:
@@ -9,6 +9,7 @@ use Symfony\Component\Console\Input\InputOption;
|
|||||||
use Symfony\Component\Console\Output\ConsoleSectionOutput;
|
use Symfony\Component\Console\Output\ConsoleSectionOutput;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use ZM\Exception\InitException;
|
use ZM\Exception\InitException;
|
||||||
|
use ZM\Utils\ZMUtil;
|
||||||
|
|
||||||
#[AsCommand(name: 'init', description: '初始化框架运行的基础文件')]
|
#[AsCommand(name: 'init', description: '初始化框架运行的基础文件')]
|
||||||
class InitCommand extends Command
|
class InitCommand extends Command
|
||||||
@@ -185,7 +186,7 @@ class InitCommand extends Command
|
|||||||
private function getVendorPath(string $file): string
|
private function getVendorPath(string $file): string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$package_name = json_decode(file_get_contents(__DIR__ . '/../../../composer.json'), true, 512, JSON_THROW_ON_ERROR)['name'];
|
$package_name = ZMUtil::getComposerMetadata()['name'];
|
||||||
} catch (\JsonException) {
|
} catch (\JsonException) {
|
||||||
throw new InitException('无法读取框架包的 composer.json', '请检查框架包完整性,或者重新安装框架包');
|
throw new InitException('无法读取框架包的 composer.json', '请检查框架包完整性,或者重新安装框架包');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user