Skip to content

Instantly share code, notes, and snippets.

@ollym
Created March 2, 2010 13:42
Show Gist options
  • Save ollym/319509 to your computer and use it in GitHub Desktop.
Save ollym/319509 to your computer and use it in GitHub Desktop.
$directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
if ($paths === NULL)
{
$paths = Kohana::paths();
}
$found = array();
foreach ($paths as $path)
{
$path = $path.$directory;
if (is_dir($path))
{
$entities = scandir($path);
foreach ($entities as $entity)
{
$path = $path.$directory.$entity;
if (is_dir($path))
{
$found += Kohana::files($directory.$entity, $paths);
}
elseif (is_file($path) AND ($entity[0] === '.' OR $entity[strlen($entity)-1] === '~'))
{
$found[$directory.$entity] = realpath($path);
}
}
}
}
return $found;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment