/**
* 初始化目录
*
* @param string $templateFile 模板文件名
*
* @return string
*/
private function initBaseDir($templateFile)
{
$baseDir = Cml::getContainer()->make('cml_route')->getAppName();
$baseDir .= '/' . Cml::getApplicationDir('app_view_path_name') . (Config::get('html_theme') != '' ? DIRECTORY_SEPARATOR . Config::get('html_theme') : '');
$layOutRootDir = $baseDir;
if ($templateFile === '') {
$baseDir .= '/' . Cml::getContainer()->make('cml_route')->getControllerName() . '/';
$file = Cml::getContainer()->make('cml_route')->getActionName();
} else {
$templateFile = str_replace('.', '/', $templateFile);
$baseDir .= DIRECTORY_SEPARATOR . dirname($templateFile) . DIRECTORY_SEPARATOR;
$file = basename($templateFile);
}
return ['layoutDir' => Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $layOutRootDir, 'layoutCacheRootPath' => Cml::getApplicationDir('runtime_cache_path') . DIRECTORY_SEPARATOR . $layOutRootDir . DIRECTORY_SEPARATOR, 'templateDir' => Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $baseDir, 'cacheDir' => Cml::getApplicationDir('runtime_cache_path') . DIRECTORY_SEPARATOR . $baseDir, 'file' => $file];
}