lib/ruboto/sdk_locations.rb in ruboto-0.12.0 vs lib/ruboto/sdk_locations.rb in ruboto-0.13.0.rc.0
- old
+ new
@@ -1,13 +1,15 @@
require 'pathname'
+require 'ruboto/util/setup'
module Ruboto
module SdkLocations
+ extend Ruboto::Util::Setup
if ENV['ANDROID_HOME']
ANDROID_HOME = ENV['ANDROID_HOME']
else
- adb_location = `#{RUBY_PLATFORM =~ /mingw|mswin/ ? 'where' : 'which'} adb`.chomp
- if adb_location.empty?
+ adb_location = which('adb')
+ unless adb_location
raise 'Unable to locate the "adb" command. Either set the ANDROID_HOME environment variable or add the location of the "adb" command to your path.'
end
ANDROID_HOME = File.dirname(File.dirname(Pathname.new(adb_location).realpath))
unless File.exists? "#{ANDROID_HOME}/tools"
puts "Found '#{adb_location}' but it is not in a proper Android SDK installation."