You are here

public function ShellOperations::findExecutablePath in Image Optimize Binaries 8

Search the local system for the given executable binary.

Parameters

null $executable: The name of the executable binary to find on the local system. If not specified the default executeable name for this class will be used.

Return value

string|false The path to the binary on the local system, or FALSE if it could not be located.

Overrides ImageAPIOptimizeShellOperationsInterface::findExecutablePath

File

src/ShellOperations.php, line 24

Class

ShellOperations
Storage controller class for "image optimize pipeline" configuration entities.

Namespace

Drupal\imageapi_optimize_binaries

Code

public function findExecutablePath($executable = NULL) {
  $output = array();
  $return_var = 0;
  $path = exec('which ' . escapeshellarg($executable), $output, $return_var);
  if ($return_var == 0) {
    return $path;
  }
  return FALSE;
}