зеркало из https://github.com/mozilla/gecko-dev.git
bug 706393 - Add API to GeckoApp to get profile dir r=mfinkle
This commit is contained in:
Родитель
3698f79b04
Коммит
7a0c8e8d0d
|
@ -111,6 +111,7 @@ abstract public class GeckoApp
|
|||
public static File sGREDir = null;
|
||||
public static Menu sMenu;
|
||||
public Handler mMainHandler;
|
||||
private File mProfileDir;
|
||||
|
||||
private IntentFilter mConnectivityFilter;
|
||||
private IntentFilter mBatteryFilter;
|
||||
|
@ -387,8 +388,10 @@ abstract public class GeckoApp
|
|||
return false;
|
||||
|
||||
String args = intent.getStringExtra("args");
|
||||
if (args != null && args.contains("-profile"))
|
||||
if (args != null && args.contains("-profile")) {
|
||||
// XXX: TO-DO set mProfileDir to the path passed in
|
||||
mUserDefinedProfile = true;
|
||||
}
|
||||
|
||||
if (intent == null)
|
||||
intent = getIntent();
|
||||
|
@ -691,6 +694,21 @@ abstract public class GeckoApp
|
|||
});
|
||||
}
|
||||
|
||||
File getProfileDir() {
|
||||
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");
|
||||
}
|
||||
});
|
||||
if (profiles.length == 1)
|
||||
mProfileDir = profiles[0];
|
||||
// XXX: TO-DO read profiles.ini to get the default profile
|
||||
}
|
||||
return mProfileDir;
|
||||
}
|
||||
|
||||
void addTab() {
|
||||
Intent intent = new Intent(mAppContext, AwesomeBar.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
|
|
|
@ -108,6 +108,7 @@ public class GeckoAppShell
|
|||
|
||||
static private File sCacheFile = null;
|
||||
static private int sFreeSpace = -1;
|
||||
static File sHomeDir = null;
|
||||
|
||||
private static HashMap<String, ArrayList<GeckoEventListener>> mEventListeners;
|
||||
|
||||
|
@ -299,8 +300,8 @@ public class GeckoAppShell
|
|||
if (Build.VERSION.SDK_INT < 8 ||
|
||||
geckoApp.getApplication().getPackageResourcePath().startsWith("/data") ||
|
||||
geckoApp.getApplication().getPackageResourcePath().startsWith("/system")) {
|
||||
File home = geckoApp.getFilesDir();
|
||||
homeDir = home.getPath();
|
||||
sHomeDir = geckoApp.getFilesDir();
|
||||
homeDir = sHomeDir.getPath();
|
||||
// handle the application being moved to phone from sdcard
|
||||
File profileDir = new File(homeDir, "mozilla");
|
||||
File oldHome = new File("/data/data/" +
|
||||
|
@ -314,8 +315,8 @@ public class GeckoAppShell
|
|||
moveDir(extProf, profileDir);
|
||||
}
|
||||
} else {
|
||||
File home = geckoApp.getExternalFilesDir(null);
|
||||
homeDir = home.getPath();
|
||||
sHomeDir = geckoApp.getExternalFilesDir(null);
|
||||
homeDir = sHomeDir.getPath();
|
||||
// handle the application being moved to phone from sdcard
|
||||
File profileDir = new File(homeDir, "mozilla");
|
||||
File oldHome = new File("/data/data/" +
|
||||
|
|
Загрузка…
Ссылка в новой задаче