You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/09/11 21:38:14 UTC
android commit: CB-7511 Auto-detect android sdk when using
stand-alone sdk installer
Repository: cordova-android
Updated Branches:
refs/heads/master 9ae3d2c07 -> 2f7ffa363
CB-7511 Auto-detect android sdk when using stand-alone sdk installer
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/2f7ffa36
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/2f7ffa36
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/2f7ffa36
Branch: refs/heads/master
Commit: 2f7ffa3636b6898d3f419c8b8a2aeb7b39860248
Parents: 9ae3d2c
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Sep 11 15:36:35 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Sep 11 15:37:22 2014 -0400
----------------------------------------------------------------------
bin/lib/check_reqs.js | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2f7ffa36/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 00137ff..edfa273 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -143,17 +143,29 @@ module.exports.check_android = function() {
var adbInPath = !!forgivingWhichSync('adb');
var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']);
function maybeSetAndroidHome(value) {
- if (fs.existsSync(value)) {
+ if (!hasAndroidHome && fs.existsSync(value)) {
hasAndroidHome = true;
process.env['ANDROID_HOME'] = value;
}
}
if (!hasAndroidHome && !androidCmdPath) {
if (isWindows) {
+ // Android Studio installer.
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-studio', 'sdk'));
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-studio', 'sdk'));
+ // Stand-alone installer.
+ maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-sdk'));
+ maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-sdk'));
} else if (process.platform == 'darwin') {
maybeSetAndroidHome('/Applications/Android Studio.app/sdk');
+ // Stand-alone zip file that user might think to put under /Applications
+ maybeSetAndroidHome('/Applications/android-sdk-macosx');
+ maybeSetAndroidHome('/Applications/android-sdk');
+ }
+ if (process.env['HOME']) {
+ // or their HOME directory.
+ maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk-macosx'));
+ maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk'));
}
}
if (hasAndroidHome && !androidCmdPath) {