зеркало из https://github.com/mozilla/pjs.git
Make it possible to set the location of the bookmarks file. Bug 31623. r=timeless, sr=waterson. Pref for this is browser.bookmarks.file - you need to edit your pref.js manually. I seem to remember you need to double your backslashes on Windows...
This commit is contained in:
Родитель
8323d80929
Коммит
7a4ed2c26f
|
@ -1,4 +1,4 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-file-style: "stroustrup" -*-
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Netscape Public
|
* The contents of this file are subject to the Netscape Public
|
||||||
* License Version 1.1 (the "License"); you may not use this file
|
* License Version 1.1 (the "License"); you may not use this file
|
||||||
|
@ -3907,26 +3907,38 @@ nsBookmarksService::Flush()
|
||||||
nsresult
|
nsresult
|
||||||
nsBookmarksService::GetBookmarksFile(nsFileSpec* aResult)
|
nsBookmarksService::GetBookmarksFile(nsFileSpec* aResult)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// Look for bookmarks.html in the current profile
|
// First we see if the user has set a pref for the location of the
|
||||||
// directory. This is as convoluted as it seems because we
|
// bookmarks file.
|
||||||
// want to 1) not break viewer (which has no profiles), and 2)
|
NS_WITH_SERVICE(nsIPref, prefServ, kPrefCID, &rv);
|
||||||
// still deal reasonably (in the short term) when no
|
|
||||||
// bookmarks.html is installed in the profile directory.
|
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> bookmarksFile;
|
|
||||||
rv = NS_GetSpecialDirectory(NS_APP_BOOKMARKS_50_FILE, getter_AddRefs(bookmarksFile));
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
nsXPIDLCString prefVal;
|
||||||
// TODO: When the code which calls this can us nsIFIle
|
rv = prefServ->CopyCharPref("browser.bookmarks.file",
|
||||||
// or nsILocalFile, this conversion from nsiFile to
|
getter_Copies(prefVal));
|
||||||
// nsFileSpec can go away.
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
*aResult = prefVal;
|
||||||
nsXPIDLCString pathBuf;
|
}
|
||||||
rv = bookmarksFile->GetPath(getter_Copies(pathBuf));
|
}
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
*aResult = (const char *)pathBuf;
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
// Otherwise, we look for bookmarks.html in the current profile
|
||||||
|
// directory using the magic directory service.
|
||||||
|
nsCOMPtr<nsIFile> bookmarksFile;
|
||||||
|
rv = NS_GetSpecialDirectory(NS_APP_BOOKMARKS_50_FILE,
|
||||||
|
getter_AddRefs(bookmarksFile));
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
||||||
|
// XXX: When the code which calls this can us nsIFile
|
||||||
|
// or nsILocalFile, this conversion from nsIFile to
|
||||||
|
// nsFileSpec can go away. Bug 36974.
|
||||||
|
|
||||||
|
nsXPIDLCString pathBuf;
|
||||||
|
rv = bookmarksFile->GetPath(getter_Copies(pathBuf));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
*aResult = pathBuf.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Загрузка…
Ссылка в новой задаче