mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/mkmf.rb (find_executable0): default path if environment is not
set. [ruby-dev:27281] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
759410a8c9
commit
4857e1d300
2 changed files with 16 additions and 2 deletions
|
@ -1,5 +1,10 @@
|
|||
Thu Sep 22 23:36:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (find_executable0): default path if environment is not
|
||||
set. [ruby-dev:27281]
|
||||
|
||||
Thu Sep 22 17:31:48 2005 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
|
||||
* test/readline/test_readline.rb (TestReadline::replace_stdio):
|
||||
merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223].
|
||||
(merged from ruby_1_8 branch)
|
||||
|
|
11
lib/mkmf.rb
11
lib/mkmf.rb
|
@ -762,8 +762,17 @@ def what_type?(type, member = nil, headers = nil, &b)
|
|||
end
|
||||
|
||||
def find_executable0(bin, path = nil)
|
||||
path = (path || ENV['PATH']).split(File::PATH_SEPARATOR)
|
||||
ext = config_string('EXEEXT')
|
||||
if File.expand_path(bin) == bin
|
||||
return bin if File.executable?(bin)
|
||||
return file if ext and File.executable?(file = bin + ext)
|
||||
return nil
|
||||
end
|
||||
if path ||= ENV['PATH']
|
||||
path = path.split(File::PATH_SEPARATOR)
|
||||
else
|
||||
path = %w[/usr/local/bin /usr/ucb /usr/bin /bin]
|
||||
end
|
||||
file = nil
|
||||
path.each do |dir|
|
||||
return file if File.executable?(file = File.join(dir, bin))
|
||||
|
|
Loading…
Reference in a new issue