Bug 704490 - Add API to get directory for any given profile (r=mfinkle)

And make it public to be accessible from other packages.
This commit is contained in:
Lucas Rocha 2011-12-08 15:52:45 +00:00
parent 0240070f42
commit 4bb7890251

View File

@ -723,17 +723,21 @@ abstract public class GeckoApp
});
}
File getProfileDir() {
public File getProfileDir() {
// XXX: TO-DO read profiles.ini to get the default profile
return getProfileDir("default");
}
public File getProfileDir(final String profileName) {
if (mProfileDir == null && !mUserDefinedProfile) {
File mozDir = new File(GeckoAppShell.sHomeDir, "mozilla");
File[] profiles = mozDir.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().endsWith(".default");
return pathname.getName().endsWith("." + profileName);
}
});
if (profiles.length == 1)
mProfileDir = profiles[0];
// XXX: TO-DO read profiles.ini to get the default profile
}
return mProfileDir;
}