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:
committed by
The Android Open Source Project
parent
62ca2ce538
commit
08ceafea54
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user