lib/calabash-android/env.rb in calabash-android-0.4.10.pre4 vs lib/calabash-android/env.rb in calabash-android-0.4.10.pre5
- old
+ new
@@ -35,10 +35,19 @@
def self.adb
%Q("#{android_home_path}/platform-tools/adb")
end
def self.android_home_path
- ENV["ANDROID_HOME"]
+ return ENV["ANDROID_HOME"] if ENV["ANDROID_HOME"]
+ monodroid_config_file = File.expand_path("~/.config/xbuild/monodroid-config.xml")
+ if File.exists?(monodroid_config_file)
+ require 'rexml/document'
+ begin
+ return REXML::Document.new(IO.read(monodroid_config_file)).elements["//android-sdk"].attributes["path"]
+ rescue
+ end
+ end
+ nil
end
def self.android_platform_path
Dir.chdir(android_home_path) do
platforms = Dir["platforms/android-*"].sort_by { |item| '%08s' % item.split('-').last }
\ No newline at end of file