]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use getenv to get the paths for `find`
authorOlivier Paroz <github@oparoz.com>
Mon, 2 Mar 2015 21:15:07 +0000 (22:15 +0100)
committerOlivier Paroz <github@oparoz.com>
Tue, 31 Mar 2015 21:49:21 +0000 (23:49 +0200)
lib/private/helper.php

index 446a6199e2b225ca2031d7addab1bac5d50d4b9b..320cbb9961872d501448f7b7208a882f290b55cd 100644 (file)
@@ -925,9 +925,10 @@ class OC_Helper {
                        // Returns null if nothing is found
                        $result = $exeSniffer->find($program);
                        if (empty($result)) {
-                               // The order of the folders is important as we'll use the first command we find
-                               exec('find /usr/local/bin/ /usr/bin/ -name ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
-                               if ($returnCode === 0 && count($output) > 0) {
+                               $paths = str_replace(':','/ ',getenv('PATH'));
+                               $command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null';
+                               exec($command, $output, $returnCode);
+                               if (count($output) > 0) {
                                        $result = escapeshellcmd($output[0]);
                                }
                        }