Skip to content

Commit

Permalink
优化Module的目录结构
Browse files Browse the repository at this point in the history
  • Loading branch information
breath-co2 committed Sep 12, 2013
1 parent e762ec2 commit cd3ca34
Show file tree
Hide file tree
Showing 37 changed files with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions core/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,12 @@ public static function auto_load($class_name)
}
elseif ($ns=='module')
{
$file = DIR_MODULE . $ns_name . DS;
$file = DIR_MODULE;

if ($new_class_name==$ns_name)
{
$file .= $ns_name . DS;
}
}
else
{
Expand Down Expand Up @@ -817,7 +822,7 @@ public static function auto_load($class_name)
# 生成一个module路径,比如 Database_Driver_MySQL 就是在 module/database 中
$include_path['module'] = array
(
'module' => DIR_MODULE .$tmp_prefix. DS,
'module' => DIR_MODULE,
);
}

Expand Down Expand Up @@ -965,8 +970,15 @@ public static function find_file($dir, $file, $ext=null, $auto_require=false)
if ($dir == 'classes')
{
# 类库目录增加 module 目录
list($module_name) = explode('/', $file, 2);
$module_dir = DIR_MODULE . $module_name . DS;
if (false===strpos($file, '/'))
{
list($module_name) = explode('/', $file, 2);
$module_dir = DIR_MODULE . $module_name . DS;
}
else
{
$module_dir = DIR_MODULE;
}

if (is_dir($module_dir))
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cd3ca34

Please sign in to comment.