diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-22 14:37:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-22 14:37:02 +0000 |
commit | bf6c0d891bee7cda96fc800054c5fcfe6d11bffc (patch) | |
tree | 7c1225ba1433d5be04bf08046cd8142daec78bb1 | |
parent | 84d371fdab00a84c1111b6a5724d5ed5dbba9348 (diff) | |
download | ruby-bf6c0d891bee7cda96fc800054c5fcfe6d11bffc.tar.gz ruby-bf6c0d891bee7cda96fc800054c5fcfe6d11bffc.tar.xz ruby-bf6c0d891bee7cda96fc800054c5fcfe6d11bffc.zip |
* lib/mkmf.rb (find_executable0): default path if environment is not
set. [ruby-dev:27281]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/mkmf.rb | 11 |
2 files changed, 16 insertions, 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) diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 29675b2d5..400d890aa 100644 --- a/lib/mkmf.rb +++ b/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)) |