зеркало из https://github.com/mozilla/pjs.git
fixing non libxul directory service handling; thanks smaug
This commit is contained in:
Родитель
192ae56099
Коммит
0bbc537403
|
@ -574,12 +574,20 @@ nsresult EmbedGlobalHistory::InitFile()
|
||||||
// Get the history file in our profile dir.
|
// Get the history file in our profile dir.
|
||||||
// Notice we are not just getting NS_APP_HISTORY_50_FILE
|
// Notice we are not just getting NS_APP_HISTORY_50_FILE
|
||||||
// because it is used by the "real" global history component.
|
// because it is used by the "real" global history component.
|
||||||
|
#ifdef MOZ_ENABLE_LIBXUL
|
||||||
if (EmbedPrivate::sProfileDir) {
|
if (EmbedPrivate::sProfileDir) {
|
||||||
nsString path;
|
nsCString path;
|
||||||
EmbedPrivate::sProfileDir->GetPath(path);
|
EmbedPrivate::sProfileDir->GetNativePath(path);
|
||||||
mHistoryFile = g_strdup_printf("%s/history.dat", NS_ConvertUTF16toUTF8(path).get());
|
mHistoryFile = g_strdup_printf("%s/history.dat", path.get());
|
||||||
BROKEN_STRING_BUILDER(mHistoryFile);
|
BROKEN_STRING_BUILDER(mHistoryFile);
|
||||||
} else {
|
} else
|
||||||
|
#else
|
||||||
|
if (EmbedPrivate::sProfileDirS) {
|
||||||
|
mHistoryFile = g_strdup_printf("%s/history.dat", EmbedPrivate::sProfileDirS);
|
||||||
|
BROKEN_STRING_BUILDER(mHistoryFile);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
mHistoryFile = g_strdup_printf("%s/history.dat", g_get_tmp_dir());
|
mHistoryFile = g_strdup_printf("%s/history.dat", g_get_tmp_dir());
|
||||||
}
|
}
|
||||||
void *uri = file_handle_uri_new(mHistoryFile);
|
void *uri = file_handle_uri_new(mHistoryFile);
|
||||||
|
|
|
@ -243,9 +243,21 @@ GTKEmbedDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EmbedPrivate::sProfileDir && !strcmp(aKey, NS_APP_USER_PROFILE_50_DIR)) {
|
if (!strcmp(aKey, NS_APP_USER_PROFILE_50_DIR)) {
|
||||||
|
#ifdef MOZ_ENABLE_LIBXUL
|
||||||
|
EmbedPrivate::sProfileDir && !strcmp(aKey, NS_APP_USER_PROFILE_50_DIR)) {
|
||||||
*aPersist = PR_TRUE;
|
*aPersist = PR_TRUE;
|
||||||
return EmbedPrivate::sProfileDir->Clone(aResult);
|
return EmbedPrivate::sProfileDir->Clone(aResult);
|
||||||
|
#else
|
||||||
|
nsCOMPtr<nsILocalFile> profDir =
|
||||||
|
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
rv = profDir->InitWithNativePath(nsDependentCString(EmbedPrivate::sProfileDirS));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
NS_ADDREF(*aResult = profDir);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -927,18 +939,16 @@ EmbedPrivate::SetAppComponents(const nsModuleComponentInfo* aComps,
|
||||||
void
|
void
|
||||||
EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
|
EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
|
||||||
{
|
{
|
||||||
|
#ifdef MOZ_ENABLE_LIBXUL
|
||||||
if (EmbedPrivate::sProfileDir) {
|
if (EmbedPrivate::sProfileDir) {
|
||||||
if (sWidgetCount) {
|
if (sWidgetCount) {
|
||||||
NS_ERROR("Cannot change profile directory during run.");
|
NS_ERROR("Cannot change profile directory during run.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef MOZ_ENABLE_LIBXUL
|
|
||||||
NS_RELEASE(EmbedPrivate::sProfileDir);
|
NS_RELEASE(EmbedPrivate::sProfileDir);
|
||||||
NS_RELEASE(EmbedPrivate::sProfileLock);
|
NS_RELEASE(EmbedPrivate::sProfileLock);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_ENABLE_LIBXUL
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
NS_NewNativeLocalFile(nsDependentCString(aDir), PR_TRUE, &EmbedPrivate::sProfileDir);
|
NS_NewNativeLocalFile(nsDependentCString(aDir), PR_TRUE, &EmbedPrivate::sProfileDir);
|
||||||
|
|
||||||
|
@ -964,9 +974,9 @@ EmbedPrivate::SetProfilePath(const char *aDir, const char *aName)
|
||||||
NS_IF_RELEASE(EmbedPrivate::sProfileDir);
|
NS_IF_RELEASE(EmbedPrivate::sProfileDir);
|
||||||
NS_IF_RELEASE(EmbedPrivate::sProfileLock);
|
NS_IF_RELEASE(EmbedPrivate::sProfileLock);
|
||||||
#else
|
#else
|
||||||
if (sProfileDir) {
|
if (sProfileDirS) {
|
||||||
nsMemory::Free(sProfileDirS);
|
nsMemory::Free(sProfileDirS);
|
||||||
sProfileDir = nsnull;
|
sProfileDirS = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sProfileName) {
|
if (sProfileName) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче