From 70f963f3475b0b9601e9445801fa130568f6dbba Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Fri, 13 Apr 2012 14:43:35 +0200 Subject: [PATCH] Use Symfony ExecutableFinder instead of custom autodetect method --- src/FFMpeg/Binary.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/FFMpeg/Binary.php b/src/FFMpeg/Binary.php index 2e24e68..bc99b53 100644 --- a/src/FFMpeg/Binary.php +++ b/src/FFMpeg/Binary.php @@ -37,7 +37,9 @@ abstract class Binary implements AdapterInterface public static function load(\Monolog\Logger $logger = null) { - if ('' === $binary = self::autodetect(static::getBinaryName())) + $finder = new \Symfony\Component\Process\ExecutableFinder(); + + if (null === $binary = $finder->find(static::getBinaryName())) { throw new Exception\BinaryNotFoundException('Binary not found'); } @@ -61,17 +63,6 @@ abstract class Binary implements AdapterInterface return $result; } - /** - * Autodetect the presence of a binary - * - * @param string $binaryName - * @return string - */ - protected static function autodetect($binaryName) - { - return trim(self::run(sprintf('which %s', escapeshellarg($binaryName)), true)); - } - protected static function getBinaryName() { throw new Exception('Should be implemented');