修正命令行文件生成

This commit is contained in:
thinkphp
2017-05-25 10:48:23 +08:00
parent 2f1a284d3b
commit d22b666540

View File

@@ -11,6 +11,7 @@
namespace think\console\command; namespace think\console\command;
use think\App;
use think\Config; use think\Config;
use think\console\Command; use think\console\Command;
use think\console\Input; use think\console\Input;
@@ -64,21 +65,21 @@ abstract class Make extends Command
return str_replace(['{%className%}', '{%namespace%}', '{%app_namespace%}'], [ return str_replace(['{%className%}', '{%namespace%}', '{%app_namespace%}'], [
$class, $class,
$namespace, $namespace,
Config::get('app_namespace') App::$namespace,
], $stub); ], $stub);
} }
protected function getPathName($name) protected function getPathName($name)
{ {
$name = str_replace(Config::get('app_namespace') . '\\', '', $name); $name = str_replace(App::$namespace . '\\', '', $name);
return APP_PATH . str_replace('\\', '/', $name) . '.php'; return APP_PATH . str_replace('\\', '/', $name) . '.php';
} }
protected function getClassName($name) protected function getClassName($name)
{ {
$appNamespace = Config::get('app_namespace'); $appNamespace = App::$namespace;
if (strpos($name, $appNamespace . '\\') === 0) { if (strpos($name, $appNamespace . '\\') === 0) {
return $name; return $name;