[Process] Add extra dirs argument to the executable finder to allow searching more dirs
This commit is contained in:
parent
2335dd0d60
commit
56f473a073
@ -45,10 +45,11 @@ class ExecutableFinder
|
|||||||
*
|
*
|
||||||
* @param string $name The executable name (without the extension)
|
* @param string $name The executable name (without the extension)
|
||||||
* @param string $default The default to return if no executable is found
|
* @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
|
* @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')) {
|
if (ini_get('open_basedir')) {
|
||||||
$searchPath = explode(PATH_SEPARATOR, getenv('open_basedir'));
|
$searchPath = explode(PATH_SEPARATOR, getenv('open_basedir'));
|
||||||
@ -64,7 +65,10 @@ class ExecutableFinder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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('');
|
$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : $this->suffixes) : array('');
|
||||||
|
Reference in New Issue
Block a user