Delay loading Pathname until we absolutely need it

This commit is contained in:
Jack Nagel 2014-04-20 17:00:44 -05:00
parent a00dcd0079
commit 201a1ad9eb

View File

@ -4,15 +4,6 @@
# But many build-systems expect it to work. This fixes that.
# NOTE only works if the build-tool calls xcrun without a path prefixed!
$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8"
require "pathname"
def canonical_dirname path
Pathname.new(path).dirname.realpath.to_s
end
SUPERBIN = canonical_dirname(__FILE__)
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
ENV.delete "DEVELOPER_DIR"
@ -25,6 +16,15 @@ if File.exist?("/usr/bin/#{ARGV.first}")
exec "/usr/bin/#{ARGV.shift}", *ARGV unless sdkroot and File.directory? sdkroot
end
$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8"
require "pathname"
def canonical_dirname path
Pathname.new(path).dirname.realpath.to_s
end
SUPERBIN = canonical_dirname(__FILE__)
def try path
exec path, *ARGV if File.executable?(path) && canonical_dirname(path) != SUPERBIN
end