diff options
author | Xavier Ducrohet <> | 2009-04-17 11:21:13 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-17 11:21:13 -0700 |
commit | 7a83c4e0ec5350a513d30bf983e58daa4bc230f2 (patch) | |
tree | b2ef7fb29c686b4c6e68d941a943418c2cd2f103 /sdkmanager | |
parent | 3f11ee56e3518f78066d971ac6afd0fa3a44aa66 (diff) | |
download | sdk-7a83c4e0ec5350a513d30bf983e58daa4bc230f2.zip sdk-7a83c4e0ec5350a513d30bf983e58daa4bc230f2.tar.gz sdk-7a83c4e0ec5350a513d30bf983e58daa4bc230f2.tar.bz2 |
AI 146740: am: CL 146692 Clean up the output of "android list targets" and fix the image.sysdir.# to only be present if the image folders really contain *.img files.
Original author: xav
Merged from: //branches/cupcake/...
Automated import of CL 146740
Diffstat (limited to 'sdkmanager')
-rw-r--r-- | sdkmanager/app/src/com/android/sdkmanager/Main.java | 10 | ||||
-rw-r--r-- | sdkmanager/libs/sdklib/src/com/android/sdklib/avd/AvdManager.java | 23 |
2 files changed, 23 insertions, 10 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java index 5924693..fc9a2be 100644 --- a/sdkmanager/app/src/com/android/sdkmanager/Main.java +++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java @@ -361,11 +361,13 @@ class Main { int index = 1; for (IAndroidTarget target : mSdkManager.getTargets()) { + mSdkLog.printf("id: %d\n", index); + mSdkLog.printf(" Name: %s\n", target.getName()); if (target.isPlatform()) { - mSdkLog.printf("[%d] %s\n", index, target.getName()); + mSdkLog.printf(" Type: Platform\n"); mSdkLog.printf(" API level: %d\n", target.getApiVersionNumber()); } else { - mSdkLog.printf("[%d] Add-on: %s\n", index, target.getName()); + mSdkLog.printf(" Type: Add-On\n"); mSdkLog.printf(" Vendor: %s\n", target.getVendor()); if (target.getDescription() != null) { mSdkLog.printf(" Description: %s\n", target.getDescription()); @@ -378,10 +380,10 @@ class Main { if (libraries != null) { mSdkLog.printf(" Libraries:\n"); for (IOptionalLibrary library : libraries) { - mSdkLog.printf(" * %1$s (%2$s)\n", + mSdkLog.printf(" * %1$s (%2$s)\n", library.getName(), library.getJarName()); mSdkLog.printf(String.format( - " %1$s\n", library.getDescription())); + " %1$s\n", library.getDescription())); } } } diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/avd/AvdManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/avd/AvdManager.java index 04281a9..0cda887 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/avd/AvdManager.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/avd/AvdManager.java @@ -119,6 +119,9 @@ public final class AvdManager { private final static Pattern INI_NAME_PATTERN = Pattern.compile("(.+)\\" + INI_EXTENSION + "$", Pattern.CASE_INSENSITIVE); + private final static Pattern IMAGE_NAME_PATTERN = Pattern.compile("(.+)\\.img$", + Pattern.CASE_INSENSITIVE); + /** * Pattern for matching SD Card sizes, e.g. "4K" or "16M". */ @@ -606,13 +609,21 @@ public final class AvdManager { } File folder = new File(imageFullPath); - if (folder.isDirectory() && folder.list().length > 0) { - imageFullPath = imageFullPath.substring(sdkLocation.length()); - if (imageFullPath.charAt(0) == File.separatorChar) { - imageFullPath = imageFullPath.substring(1); + if (folder.isDirectory()) { + String[] list = folder.list(new FilenameFilter() { + public boolean accept(File dir, String name) { + return IMAGE_NAME_PATTERN.matcher(name).matches(); + } + }); + + if (list.length > 0) { + imageFullPath = imageFullPath.substring(sdkLocation.length()); + if (imageFullPath.charAt(0) == File.separatorChar) { + imageFullPath = imageFullPath.substring(1); + } + + return imageFullPath; } - - return imageFullPath; } return null; |