AndroidLocationpublic final class AndroidLocation extends Object Manages the location of the android files (including emulator files, ddms config, debug keystore) |
Fields Summary |
---|
public static final String | FOLDER_AVDVirtual Device folder inside the path returned by {@link #getFolder()} | private static String | sPrefsLocation |
Methods Summary |
---|
private static java.lang.String | findValidPath(java.lang.String names)Checks a list of system properties and/or system environment variables for validity, and
existing director, and returns the first one.
for (String name : names) {
String path;
if (name.indexOf('.") != -1) {
path = System.getProperty(name);
} else {
path = System.getenv(name);
}
if (path != null) {
File f = new File(path);
if (f.isDirectory()) {
return path;
}
}
}
return null;
| public static final java.lang.String | getFolder()Returns the folder used to store android related files.
if (sPrefsLocation == null) {
String home = findValidPath("ANDROID_SDK_HOME", "user.home", "HOME");
// if the above failed, we throw an exception.
if (home == null) {
throw new AndroidLocationException(
"Unable to get the home directory. Make sure the user.home property is set up");
} else {
sPrefsLocation = home + File.separator + ".android" + File.separator;
// make sure the folder exists!
File f = new File(sPrefsLocation);
if (f.exists() == false) {
f.mkdir();
} else if (f.isFile()) {
throw new AndroidLocationException(sPrefsLocation +
" is not a directory! This is required to run Android tools.");
}
}
}
return sPrefsLocation;
|
|