Skip to content
Permalink
Browse files

Adding _pluginPath to Shell.

provides one method to find plugins in shells.
  • Loading branch information...
markstory committed Jun 6, 2009
1 parent 928ec36 commit d312cd3215248614a05df3a641ea46d3e21c7798
Showing with 16 additions and 0 deletions.
  1. +16 −0 cake/console/libs/shell.php
@@ -611,5 +611,21 @@ function _singularHumanName($name) {
function _pluralHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
}
/**
* Find the correct path for a plugin. Scans $pluginPaths for the plugin you want.
*
* @param string $pluginName Name of the plugin you want ie. DebugKit
* @return string $path path to the correct plugin.
**/
function _pluginPath($pluginName) {
$pluginPaths = Configure::read('pluginPaths');
$pluginDirName = Inflector::underscore($pluginName);
foreach ($pluginPaths as $path) {
if (is_dir($path . $pluginDirName)) {
return $path . $pluginDirName . DS ;
}
}
return $pluginPaths[0] . $pluginDirName . DS;
}
}
?>

0 comments on commit d312cd3

Please sign in to comment.
You can’t perform that action at this time.