Get the basename and dirname once
This commit is contained in:
parent
988ec8de98
commit
28b926686b
@ -29,8 +29,8 @@ class Cmd
|
|||||||
attr_reader :config, :prefix, :cellar, :tmpdir, :sysroot
|
attr_reader :config, :prefix, :cellar, :tmpdir, :sysroot
|
||||||
attr_reader :archflags, :optflags
|
attr_reader :archflags, :optflags
|
||||||
|
|
||||||
def initialize path, args
|
def initialize(arg0, args)
|
||||||
@arg0 = File.basename(path).freeze
|
@arg0 = arg0
|
||||||
@args = args.freeze
|
@args = args.freeze
|
||||||
@config = ENV.fetch("HOMEBREW_CCCFG") { "" }
|
@config = ENV.fetch("HOMEBREW_CCCFG") { "" }
|
||||||
@prefix = ENV['HOMEBREW_PREFIX']
|
@prefix = ENV['HOMEBREW_PREFIX']
|
||||||
@ -332,14 +332,16 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
|
|
||||||
####################################################################### main
|
####################################################################### main
|
||||||
|
|
||||||
LOGGER.puts "#{File.basename($0)} called with: #{ARGV.join(" ")}"
|
dirname, basename = File.split($0)
|
||||||
|
|
||||||
cmd = Cmd.new($0, ARGV)
|
LOGGER.puts "#{basename} called with: #{ARGV.join(" ")}"
|
||||||
|
|
||||||
|
cmd = Cmd.new(basename, ARGV)
|
||||||
tool, args = cmd.tool, cmd.args
|
tool, args = cmd.tool, cmd.args
|
||||||
|
|
||||||
LOGGER.puts "superenv executed: #{tool} #{args.join(" ")}"
|
LOGGER.puts "superenv executed: #{tool} #{args.join(" ")}"
|
||||||
LOGGER.log!
|
LOGGER.log!
|
||||||
|
|
||||||
args << { :close_others => false } if RUBY_VERSION >= "2.0"
|
args << { :close_others => false } if RUBY_VERSION >= "2.0"
|
||||||
exec "#{File.dirname($0)}/xcrun", tool, *args
|
exec "#{dirname}/xcrun", tool, *args
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user