diff options
author | Siva Velusamy <vsiva@google.com> | 2012-12-06 15:24:26 -0800 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-12-06 15:24:26 -0800 |
commit | 2b5876214e16f845d7b94857a39a83f8b8b7ef85 (patch) | |
tree | 0e0e3f6232c77431ad1348bb0de8134d969a21be | |
parent | 3a463656f6c485635a9540761753f564068a63a7 (diff) | |
parent | 8ff2dbad2e57442262de5f94c44af511bd2d2ee2 (diff) | |
download | sdk-2b5876214e16f845d7b94857a39a83f8b8b7ef85.zip sdk-2b5876214e16f845d7b94857a39a83f8b8b7ef85.tar.gz sdk-2b5876214e16f845d7b94857a39a83f8b8b7ef85.tar.bz2 |
Merge "monitor: Prefer using bundled SDK rather than lastSdk"
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java b/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java index ef8f186..425786f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java +++ b/eclipse/plugins/com.android.ide.eclipse.monitor/src/com/android/ide/eclipse/monitor/MonitorApplication.java @@ -122,26 +122,30 @@ public class MonitorApplication implements IApplication { return sdkLocation; } - // check for the last used SDK - sdkLocation = MonitorPlugin.getDdmsPreferenceStore().getLastSdkPath(); - if (isValidSdkLocation(sdkLocation)) { - return sdkLocation; - } - - // The monitor app should be located in "<sdk>/tools/monitor/" + // The monitor app should be located in "<sdk>/tools/lib/monitor-platform/" // So see if the folder one level up from the install location is a valid SDK. Location install = Platform.getInstallLocation(); if (install != null && install.getURL() != null) { - String toolsFolder = new File(install.getURL().getFile()).getParent(); - if (toolsFolder != null) { - sdkLocation = new File(toolsFolder).getParent(); - if (isValidSdkLocation(sdkLocation)) { - MonitorPlugin.getDdmsPreferenceStore().setLastSdkPath(sdkLocation); - return sdkLocation; + File libFolder = new File(install.getURL().getFile()).getParentFile(); + if (libFolder != null) { + String toolsFolder = libFolder.getParent(); + if (toolsFolder != null) { + sdkLocation = new File(toolsFolder).getParent(); + if (isValidSdkLocation(sdkLocation)) { + MonitorPlugin.getDdmsPreferenceStore().setLastSdkPath(sdkLocation); + return sdkLocation; + } } + } } + // check for the last used SDK + sdkLocation = MonitorPlugin.getDdmsPreferenceStore().getLastSdkPath(); + if (isValidSdkLocation(sdkLocation)) { + return sdkLocation; + } + // if nothing else works, prompt the user sdkLocation = getSdkLocationFromUser(new Shell(display)); if (isValidSdkLocation(sdkLocation)) { |