diff options
author | Christian Schneider | 2008-02-07 04:21:48 +0000 |
---|---|---|
committer | Christian Schneider | 2008-02-07 04:21:48 +0000 |
commit | fc9d05c24cb24db5326d6a2dde0835993c8731a0 (patch) | |
tree | a7509b9075a4ba271f24108fb83ce39508d6d1ed /it_auto_prepend.php | |
parent | 258822f10abfe3ce6278487424b682cf029ee77f (diff) | |
download | itools-fc9d05c24cb24db5326d6a2dde0835993c8731a0.tar.gz itools-fc9d05c24cb24db5326d6a2dde0835993c8731a0.tar.bz2 itools-fc9d05c24cb24db5326d6a2dde0835993c8731a0.zip |
Make autoloader and syntaxconvert cooperate
Fix include path separator for Windows
Diffstat (limited to 'it_auto_prepend.php')
-rw-r--r-- | it_auto_prepend.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/it_auto_prepend.php b/it_auto_prepend.php index 87ec0a0..ee804b2 100644 --- a/it_auto_prepend.php +++ b/it_auto_prepend.php @@ -45,7 +45,7 @@ function it_initialize() if ($autoloader = function_exists('spl_autoload_register') && spl_autoload_register('it_classloader')) { - ini_set('include_path', "$it_path:$include_path"); + ini_set('include_path', $it_path . PATH_SEPARATOR . $include_path); require_once("$it_path/auto_prepend.php"); if (file_exists("$it_path/auto_prepend_local.php")) @@ -53,7 +53,7 @@ function it_initialize() } else { - ini_set('include_path', "$it_path/..:$include_path"); + ini_set('include_path', "$it_path/.." . PATH_SEPARATOR . $include_path); require("itools.lib"); # PHP 4 fallback } @@ -71,11 +71,11 @@ function it_initialize() } @set_error_handler("it_errorhandler", E_USER_ERROR | E_RECOVERABLE_ERROR | E_WARNING | E_USER_WARNING | E_NOTICE | E_USER_NOTICE); - ini_set('include_path', $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter:$it_path:$include_path"); - $user_includes = explode(":", $include_path); + ini_set('include_path', $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter" . PATH_SEPARATOR . $it_path . PATH_SEPARATOR . $include_path); + $user_includes = explode(PATH_SEPARATOR, $include_path); # XXX Note: Comment this out if you want system wide include path converted and auto_prepend.php considered - $user_includes = array_diff($user_includes, array_diff(explode(":", get_cfg_var('include_path')), array("."))); + $user_includes = array_diff($user_includes, array_diff(explode(PATH_SEPARATOR, get_cfg_var('include_path')), array("."))); foreach (array_reverse($user_includes) as $include) { @@ -118,14 +118,17 @@ function it_initialize() function it_convert($source) { + $sourcerelpath = it::replace(array('^(/|\w:)' => ""), $source); # Remove leading / or C: + if (@is_dir($source) && !@is_link($source)) { + ini_set('include_path', $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter/$sourcerelpath" . PATH_SEPARATOR . ini_get('include_path')); foreach (glob("$source/*") as $file) it_convert($file); } else if (@is_readable($source)) { - $converted = $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter/$source"; + $converted = $GLOBALS['IT_SYNTAXCONVERTER_DIR'] . "/it_syntaxconverter/$sourcerelpath"; if (@filemtime($converted) < filemtime($source)) { |