diff options
-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)) { |