cvs: php4 /pear System.php

From: Date: Thu, 09 Jan 2003 15:11:28 +0000
Subject: cvs: php4 /pear System.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8143@lists.php.net to get a copy of this message
ssb Thu Jan 9 10:11:28 2003 EDT Modified files: /php4/pear System.php Log: * System::which() now checks .exe .bat .cmd and .com on Windows Index: php4/pear/System.php diff -u php4/pear/System.php:1.24 php4/pear/System.php:1.25 --- php4/pear/System.php:1.24 Tue Dec 31 11:18:23 2002 +++ php4/pear/System.php Thu Jan 9 10:11:27 2003 @@ -16,7 +16,7 @@ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: System.php,v 1.24 2002/12/31 16:18:23 sebastian Exp $ +// $Id: System.php,v 1.25 2003/01/09 15:11:27 ssb Exp $ // require_once 'PEAR.php'; @@ -43,7 +43,7 @@ * * @package System * @author Tomas V.V.Cox <cox@idecnet.com> -* @version $Revision: 1.24 $ +* @version $Revision: 1.25 $ * @access public * @see http://pear.php.net/manual/ */ @@ -433,15 +433,17 @@ // 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 +?>

« previous php.pear.cvs (#8143) next »