summaryrefslogtreecommitdiff
path: root/pear
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2003-01-09 15:11:27 +0000
committerStig Bakken <ssb@php.net>2003-01-09 15:11:27 +0000
commit796083b936bdc9d524fc605afd489f08f842d499 (patch)
tree795b785244b78ad6f10fa8da0d588026286b1daf /pear
parent239d203e4a7f96f7fa8dbc954fbeb152dd594798 (diff)
downloadphp-git-796083b936bdc9d524fc605afd489f08f842d499.tar.gz
* System::which() now checks .exe .bat .cmd and .com on Windows
Diffstat (limited to 'pear')
-rw-r--r--pear/System.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/pear/System.php b/pear/System.php
index e9341b3db6..98754e9e17 100644
--- a/pear/System.php
+++ b/pear/System.php
@@ -433,15 +433,17 @@ class System
// XXX FIXME honor safe mode
$path_delim = OS_WINDOWS ? ';' : ':';
- $exe_suffix = OS_WINDOWS ? '.exe' : '';
+ $exe_suffixes = OS_WINDOWS ? array('.exe','.bat','.cmd','.com') : array('');
$path_elements = explode($path_delim, getenv('PATH'));
- foreach ($path_elements as $dir) {
- $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix;
- if (@is_file($file) && @$pear_is_executable($file)) {
- return $file;
+ foreach ($exe_suffixes as $suff) {
+ foreach ($path_elements as $dir) {
+ $file = $dir . DIRECTORY_SEPARATOR . $program . $suff;
+ if (@is_file($file) && @$pear_is_executable($file)) {
+ return $file;
+ }
}
}
return $fallback;
}
}
-?> \ No newline at end of file
+?>