In some cases it is necessary to share code and using seperate directories especially while connecting code from different locations via svn:external property.
My problem was, that the classes are not loaded.
I fixed it an would like to give you the patch. (changed Loader.php)
aim is to provide possibilities:
$this->load->library('ext_xpath/xpath');
patch is about 11 lines ( mainly replacements )
the essentials:
diff—normal old_Loader.php new_Loader.php
680c680,689
<
—-
>
> /**
> * add support for classes with paths
> */
> $class_dir = dirname( $class );
> if ( strlen($class_dir) > 0 )
> {
> $class = str_replace($class_dir.’/’,’‘,$class);
> }
>
683a693
> $class_path = ‘libraries/’.$class_dir.’/’;
685c695
< if (file_exists(APPPATH.‘libraries/’.config_item(‘subclass_prefix’).$class.EXT))
—-
> if (file_exists(APPPATH.$class_path.config_item(‘subclass_prefix’).$class.EXT))
687c697
< if ( ! file_exists(BASEPATH.‘libraries/’.ucfirst($class).EXT))
—-
> if ( ! file_exists(BASEPATH.$class_path.ucfirst($class).EXT))
693,694c703,704
< include(BASEPATH.‘libraries/’.ucfirst($class).EXT);
< include(APPPATH.‘libraries/’.config_item(‘subclass_prefix’).$class.EXT);
—-
> include(BASEPATH.$class_path.ucfirst($class).EXT);
> include(APPPATH.$class_path.config_item(‘subclass_prefix’).$class.EXT);
704c714
< $fp = $path.‘libraries/’.$class.EXT;
—-
> $fp = $path.$class_path.$class.EXT;
diff -c old_Loader.php new_Loader.php
*** old_Loader.php 2007-02-12 19:15:51.041504304 +0100
--- new_Loader.php 2007-02-12 19:14:44.000000000 +0100
***************
*** 677,697 ****
{
// Get the class name
$class = str_replace(EXT, '', $class);
!
// We'll test for both lowercase and capitalized versions of the file name
foreach (array(ucfirst($class), strtolower($class)) as $class)
{
// Is this a class extension request?
! if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
{
! if ( ! file_exists(BASEPATH.'libraries/'.ucfirst($class).EXT))
{
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
}
! include(BASEPATH.'libraries/'.ucfirst($class).EXT);
! include(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
return $this->_ci_init_class($class, config_item('subclass_prefix'), $params);
}
--- 677,707 ----
{
// Get the class name
$class = str_replace(EXT, '', $class);
!
! /**
! * add support for classes with paths
! */
! $class_dir = dirname( $class );
! if ( strlen($class_dir) > 0 )
! {
! $class = str_replace($class_dir.'/','',$class);
! }
!
// We'll test for both lowercase and capitalized versions of the file name
foreach (array(ucfirst($class), strtolower($class)) as $class)
{
+ $class_path = 'libraries/'.$class_dir.'/';
// Is this a class extension request?
! if (file_exists(APPPATH.$class_path.config_item('subclass_prefix').$class.EXT))
{
! if ( ! file_exists(BASEPATH.$class_path.ucfirst($class).EXT))
{
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
}
! include(BASEPATH.$class_path.ucfirst($class).EXT);
! include(APPPATH.$class_path.config_item('subclass_prefix').$class.EXT);
return $this->_ci_init_class($class, config_item('subclass_prefix'), $params);
}
***************
*** 701,707 ****
for ($i = 1; $i < 3; $i++)
{
$path = ($i % 2) ? APPPATH : BASEPATH;
! $fp = $path.'libraries/'.$class.EXT;
// Does the file exist? No? Bummer...
if ( ! file_exists($fp))
--- 711,717 ----
for ($i = 1; $i < 3; $i++)
{
$path = ($i % 2) ? APPPATH : BASEPATH;
! $fp = $path.$class_path.$class.EXT;
// Does the file exist? No? Bummer...
if ( ! file_exists($fp))
hope you will add this in your next release
