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
This commit is contained in:
Xavier Ducrohet
2009-04-17 11:21:13 -07:00
committed by The Android Open Source Project
parent 62ca2ce538
commit 08ceafea54
2 changed files with 23 additions and 10 deletions

View File

@@ -361,11 +361,13 @@ class Main {
int index = 1; int index = 1;
for (IAndroidTarget target : mSdkManager.getTargets()) { for (IAndroidTarget target : mSdkManager.getTargets()) {
mSdkLog.printf("id: %d\n", index);
mSdkLog.printf(" Name: %s\n", target.getName());
if (target.isPlatform()) { if (target.isPlatform()) {
mSdkLog.printf("[%d] %s\n", index, target.getName()); mSdkLog.printf(" Type: Platform\n");
mSdkLog.printf(" API level: %d\n", target.getApiVersionNumber()); mSdkLog.printf(" API level: %d\n", target.getApiVersionNumber());
} else { } else {
mSdkLog.printf("[%d] Add-on: %s\n", index, target.getName()); mSdkLog.printf(" Type: Add-On\n");
mSdkLog.printf(" Vendor: %s\n", target.getVendor()); mSdkLog.printf(" Vendor: %s\n", target.getVendor());
if (target.getDescription() != null) { if (target.getDescription() != null) {
mSdkLog.printf(" Description: %s\n", target.getDescription()); mSdkLog.printf(" Description: %s\n", target.getDescription());
@@ -378,10 +380,10 @@ class Main {
if (libraries != null) { if (libraries != null) {
mSdkLog.printf(" Libraries:\n"); mSdkLog.printf(" Libraries:\n");
for (IOptionalLibrary library : libraries) { for (IOptionalLibrary library : libraries) {
mSdkLog.printf(" * %1$s (%2$s)\n", mSdkLog.printf(" * %1$s (%2$s)\n",
library.getName(), library.getJarName()); library.getName(), library.getJarName());
mSdkLog.printf(String.format( mSdkLog.printf(String.format(
" %1$s\n", library.getDescription())); " %1$s\n", library.getDescription()));
} }
} }
} }

View File

@@ -119,6 +119,9 @@ public final class AvdManager {
private final static Pattern INI_NAME_PATTERN = Pattern.compile("(.+)\\" + INI_EXTENSION + "$", private final static Pattern INI_NAME_PATTERN = Pattern.compile("(.+)\\" + INI_EXTENSION + "$",
Pattern.CASE_INSENSITIVE); 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". * Pattern for matching SD Card sizes, e.g. "4K" or "16M".
*/ */
@@ -606,13 +609,21 @@ public final class AvdManager {
} }
File folder = new File(imageFullPath); File folder = new File(imageFullPath);
if (folder.isDirectory() && folder.list().length > 0) { if (folder.isDirectory()) {
imageFullPath = imageFullPath.substring(sdkLocation.length()); String[] list = folder.list(new FilenameFilter() {
if (imageFullPath.charAt(0) == File.separatorChar) { public boolean accept(File dir, String name) {
imageFullPath = imageFullPath.substring(1); 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; return null;