Permalink
Browse files

Adding App::pluginPath() to find paths for plugins.

  • Loading branch information...
1 parent 10aa5d1 commit e5088f761326e2149ec749d8694ce390f640ae28 @markstory markstory committed Aug 28, 2009
Showing with 17 additions and 0 deletions.
  1. +17 −0 cake/libs/configure.php
View
@@ -668,6 +668,23 @@ function build($paths = array(), $reset = false) {
}
}
+/**
+ * Get the path that a plugin is on. Searches through the defined plugin paths.
+ *
+ * @param string $plugin CamelCased plugin name to find the path of.
+ * @return string full path to the plugin.
+ **/
+ function pluginPath($plugin) {
+ $_this =& App::getInstance();
+ $pluginDir = Inflector::underscore($plugin);
+ foreach ($_this->plugins as $path) {
+ if (is_dir($path . $pluginDir)) {
+ return $path . $pluginDir . DS ;
+ }
+ return $_this->plugins[0] . $pluginDir . DS;
+ }
+ }
+
/**
* Returns a key/value list of all paths where core libs are found.
* Passing $type only returns the values for a given value of $key.

0 comments on commit e5088f7

Please sign in to comment.