Bug 924894 - Split prefs files up for Metro and Desktop when running in the same profile. r=jimm

This commit is contained in:
Brian R. Bondy 2013-11-05 13:20:39 -05:00
parent 43df2515e7
commit 73b11d1135
4 changed files with 19 additions and 1 deletions

View File

@ -752,7 +752,15 @@ Preferences::UseDefaultPrefFile()
nsresult rv;
nsCOMPtr<nsIFile> aFile;
rv = NS_GetSpecialDirectory(NS_APP_PREFS_50_FILE, getter_AddRefs(aFile));
#if defined(XP_WIN) && defined(MOZ_METRO)
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
rv = NS_GetSpecialDirectory(NS_METRO_APP_PREFS_50_FILE, getter_AddRefs(aFile));
} else
#endif
{
rv = NS_GetSpecialDirectory(NS_APP_PREFS_50_FILE, getter_AddRefs(aFile));
}
if (NS_SUCCEEDED(rv)) {
rv = ReadAndOwnUserPrefFile(aFile);
// Most likely cause of failure here is that the file didn't

View File

@ -16,6 +16,7 @@
// File Name Defines
#define PREFS_FILE_50_NAME NS_LITERAL_CSTRING("prefs.js")
#define PREFS_FILE_METRO_50_NAME NS_LITERAL_CSTRING("metro-prefs.js")
#define USER_CHROME_DIR_50_NAME NS_LITERAL_CSTRING("chrome")
#define LOCAL_STORE_FILE_50_NAME NS_LITERAL_CSTRING("localstore.rdf")
#define PANELS_FILE_50_NAME NS_LITERAL_CSTRING("panels.rdf")
@ -169,6 +170,11 @@ nsProfileDirServiceProvider::GetFile(const char *prop, bool *persistant, nsIFile
if (NS_SUCCEEDED(rv))
rv = localFile->AppendNative(PREFS_FILE_50_NAME);
}
else if (strcmp(prop, NS_METRO_APP_PREFS_50_FILE) == 0) {
rv = domainDir->Clone(getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv))
rv = localFile->AppendNative(PREFS_FILE_METRO_50_NAME);
}
else if (strcmp(prop, NS_APP_USER_PROFILE_50_DIR) == 0) {
rv = domainDir->Clone(getter_AddRefs(localFile));
}

View File

@ -400,6 +400,9 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
else if (!strcmp(aProperty, NS_APP_PREFS_50_FILE)) {
rv = file->AppendNative(NS_LITERAL_CSTRING("prefs.js"));
}
else if (!strcmp(aProperty, NS_METRO_APP_PREFS_50_FILE)) {
rv = file->AppendNative(NS_LITERAL_CSTRING("metro-prefs.js"));
}
else if (!strcmp(aProperty, NS_LOCALSTORE_UNSAFE_FILE)) {
rv = file->AppendNative(NS_LITERAL_CSTRING("localstore.rdf"));
}

View File

@ -62,6 +62,7 @@
#define NS_APP_PREFS_50_DIR "PrefD" // Directory which contains user prefs
#define NS_APP_PREFS_50_FILE "PrefF"
#define NS_METRO_APP_PREFS_50_FILE "MetroPrefF" // Metro browser prefs file
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
#define NS_EXT_PREFS_DEFAULTS_DIR_LIST "ExtPrefDL"
#define NS_APP_PREFS_OVERRIDE_DIR "PrefDOverride" // Directory for per-profile defaults