From 62be981016cdcee353ab538d089174fd8cce0f9e Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sat, 22 Aug 2015 13:21:13 +0800 Subject: [PATCH] use Pathname#executable? directly --- Library/Homebrew/os/mac.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index c2c909d768..bcaf848581 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -27,8 +27,8 @@ module OS @locate[key] = if File.executable?(path = "/usr/bin/#{tool}") Pathname.new path # Homebrew GCCs most frequently; much faster to check this before xcrun - elsif File.executable?(path = "#{HOMEBREW_PREFIX}/bin/#{tool}") - Pathname.new path + elsif (path = HOMEBREW_PREFIX/"bin/#{tool}").executable? + path else path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool).chomp Pathname.new(path) if File.executable?(path) @@ -39,8 +39,8 @@ module OS # Locates a (working) copy of install_name_tool, guaranteed to function # whether the user has developer tools installed or not. def install_name_tool - if File.executable?(path = "#{HOMEBREW_PREFIX}/opt/cctools/bin/install_name_tool") - Pathname.new(path) + if (path = HOMEBREW_PREFIX/"opt/cctools/bin/install_name_tool").executable? + path else locate("install_name_tool") end @@ -49,8 +49,8 @@ module OS # Locates a (working) copy of otool, guaranteed to function whether the user # has developer tools installed or not. def otool - if File.executable?(path = "#{HOMEBREW_PREFIX}/opt/cctools/bin/otool") - Pathname.new(path) + if (path = HOMEBREW_PREFIX/"opt/cctools/bin/otool").executable? + path else locate("otool") end