diff options
author | Siva Velusamy <vsiva@google.com> | 2012-12-06 14:40:19 -0800 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2012-12-06 15:11:24 -0800 |
commit | 8ff2dbad2e57442262de5f94c44af511bd2d2ee2 (patch) | |
tree | 480ff821a50f12e4dff458907da89f32d4629ea2 /eclipse | |
parent | 43a22f0157e3537a04afca8cc433e17c7853be33 (diff) | |
download | sdk-8ff2dbad2e57442262de5f94c44af511bd2d2ee2.zip sdk-8ff2dbad2e57442262de5f94c44af511bd2d2ee2.tar.gz sdk-8ff2dbad2e57442262de5f94c44af511bd2d2ee2.tar.bz2 |
monitor: Prefer using bundled SDK rather than lastSdk
Also fix the path to bundled SDK: monitor is in tools/lib/monitor,
not tools/monitor
Change-Id: Ia47112b8358076a8d93cc6492bc67490386459e7
Diffstat (limited to 'eclipse')
-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)) { |