Added OS specific lookup commands

This resolved my issue on OSX and should clear up any issues on Windows. Will
need confirmation from a Windows user though. Closes #2
This commit is contained in:
Joshua Sherman 2014-01-20 18:12:31 -05:00
parent adf9a5bdef
commit c1adcad92a

View file

@ -62,8 +62,16 @@ class ClosureCompiler
*/
public function getBinary()
{
if (PHP_OS == 'Darwin') {
$command = 'whereis';
} elseif (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$command = 'where';
} else {
$command = 'which';
}
if (!$this->java) {
$this->java = rtrim(shell_exec('which java'));
$this->java = rtrim(shell_exec($command . ' java'));
if (!$this->java) {
throw new \RuntimeException('java could not be found in PATH.');
}