Skip to content

Commit

Permalink
[Process] Add extra dirs argument to the executable finder to allow s…
Browse files Browse the repository at this point in the history
…earching more dirs
  • Loading branch information
Seldaek committed Jul 3, 2012
1 parent 2335dd0 commit 56f473a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Symfony/Component/Process/ExecutableFinder.php
Expand Up @@ -43,12 +43,13 @@ public function addSuffix($suffix)
/**
* Finds an executable by name.
*
* @param string $name The executable name (without the extension)
* @param string $default The default to return if no executable is found
* @param string $name The executable name (without the extension)
* @param string $default The default to return if no executable is found
* @param array $extraDirs Additional dirs to check into
*
* @return string The executable path or default value
*/
public function find($name, $default = null)
public function find($name, $default = null, array $extraDirs = array())
{
if (ini_get('open_basedir')) {
$searchPath = explode(PATH_SEPARATOR, getenv('open_basedir'));
Expand All @@ -64,7 +65,10 @@ public function find($name, $default = null)
}
}
} else {
$dirs = explode(PATH_SEPARATOR, getenv('PATH') ? getenv('PATH') : getenv('Path'));
$dirs = array_merge(
explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
$extraDirs
);
}

$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : $this->suffixes) : array('');
Expand Down

0 comments on commit 56f473a

Please sign in to comment.