* @return A new {@link AvdInfo} with an {@link AvdStatus} indicating whether this AVD is
* valid or not.
*/
private AvdInfo parseAvdInfo(File iniPath, ILogger log) {
Map<String, String> map = parseIniFile(
new FileWrapper(iniPath),
log);
String avdPath = map.get(AVD_INFO_ABS_PATH);
String targetHash = map.get(AVD_INFO_TARGET);
if (!(new File(avdPath).isDirectory())) {
// Try to fallback on the relative path, if present.
String relPath = map.get(AVD_INFO_REL_PATH);
if (relPath != null) {
try {
String androidPath = AndroidLocation.getFolder();
File f = new File(androidPath, relPath);
if (f.isDirectory()) {
avdPath = f.getAbsolutePath();
}
} catch (AndroidLocationException ignore) {}
}
}
IAndroidTarget target = null;
FileWrapper configIniFile = null;
Map<String, String> properties = null;
if (targetHash != null) {
target = myLocalSdk.getTargetFromHashString(targetHash);
}
// load the AVD properties.
if (avdPath != null) {
configIniFile = new FileWrapper(avdPath, CONFIG_INI);
}
if (configIniFile != null) {
if (!configIniFile.isFile()) {
log.warning("Missing file '%1$s'.", configIniFile.getPath());
} else {
properties = parseIniFile(configIniFile, log);
}
}