From c1adcad92a476b76cf4bbac40524d01efb4fd5a0 Mon Sep 17 00:00:00 2001 From: Joshua Sherman Date: Mon, 20 Jan 2014 18:12:31 -0500 Subject: [PATCH] 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 --- src/ClosureCompiler/ClosureCompiler.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ClosureCompiler/ClosureCompiler.php b/src/ClosureCompiler/ClosureCompiler.php index 7d712ce..d5c0806 100644 --- a/src/ClosureCompiler/ClosureCompiler.php +++ b/src/ClosureCompiler/ClosureCompiler.php @@ -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.'); }