Duh. Write them to the correct place, as well.

git-svn-id: svn://10.0.0.236/trunk@235567 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com 2007-09-12 17:41:22 +00:00
parent e0b3059d8e
commit 02d5cf287f

View File

@ -1663,14 +1663,35 @@ nsBookmarksService::ReadBookmarks()
nsresult
nsBookmarksService::WriteBookmarks(nsIRDFDataSource *ds, nsIRDFResource *root)
{
nsSpecialSystemDirectory bookmarksFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
nsresult rv;
// XXX we should get this from prefs.
bookmarksFile += "res";
bookmarksFile += "samples";
bookmarksFile += "bookmarks.html";
// Look for bookmarks.html in the current profile
// directory. This is as convoluted as it seems because we
// want to 1) not break viewer (which has no profiles), and 2)
// still deal reasonably (in the short term) when no
// bookmarks.html is installed in the profile directory.
nsFileSpec bookmarksFile;
do {
NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv);
if (NS_FAILED(rv)) break;
nsresult rv = NS_ERROR_FAILURE;
rv = profile->GetCurrentProfileDir(&bookmarksFile);
if (NS_FAILED(rv)) break;
bookmarksFile += "bookmarks.html";
if (! bookmarksFile.Exists())
rv = NS_ERROR_FAILURE;
} while (0);
if (NS_FAILED(rv)) {
bookmarksFile = nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
bookmarksFile += "res";
bookmarksFile += "samples";
bookmarksFile += "bookmarks.html";
}
rv = NS_ERROR_FAILURE;
nsOutputFileStream strm(bookmarksFile);
if (strm.is_open())
{