diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 9d98e4a557f..b22294397d6 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -359,6 +359,15 @@ BrowserGlue.prototype = { var bookmarksFile = dirService.get("BMarks", Ci.nsILocalFile); + if (!bookmarksFile.exists()) { + // if bookmarks file does not exist, import default bookmarks + var bookmarksFileName = "bookmarks.html"; + bookmarksFile = dirService.get("profDef", Ci.nsILocalFile); + bookmarksFile.append(bookmarksFileName); + var profDir = dirService.get("ProfD", Ci.nsILocalFile); + bookmarksFile.copyTo(profDir, bookmarksFileName); + } + if (bookmarksFile.exists()) { // import the file try { diff --git a/toolkit/profile/src/nsToolkitProfileService.cpp b/toolkit/profile/src/nsToolkitProfileService.cpp index 13b910e9b56..959b3d37615 100644 --- a/toolkit/profile/src/nsToolkitProfileService.cpp +++ b/toolkit/profile/src/nsToolkitProfileService.cpp @@ -686,30 +686,7 @@ nsToolkitProfileService::CreateProfile(nsILocalFile* aRootDir, return NS_ERROR_FILE_NOT_DIRECTORY; } else { - nsCOMPtr profileDefaultsDir; - nsCOMPtr profileDirParent; - nsCAutoString profileDirName; - - rv = rootDir->GetParent(getter_AddRefs(profileDirParent)); - NS_ENSURE_SUCCESS(rv, rv); - - rv = rootDir->GetNativeLeafName(profileDirName); - NS_ENSURE_SUCCESS(rv, rv); - - PRBool dummy; - rv = gDirServiceProvider->GetFile(NS_APP_PROFILE_DEFAULTS_50_DIR, &dummy, - getter_AddRefs(profileDefaultsDir)); - - if (NS_SUCCEEDED(rv)) - rv = profileDefaultsDir->CopyToNative(profileDirParent, - profileDirName); - if (NS_FAILED(rv)) { - // if copying failed, lets just ensure that the profile directory exists. - rv = rootDir->Create(nsIFile::DIRECTORY_TYPE, 0700); - NS_ENSURE_SUCCESS(rv, rv); - } - - rv = rootDir->SetPermissions(0700); + rv = rootDir->Create(nsIFile::DIRECTORY_TYPE, 0700); NS_ENSURE_SUCCESS(rv, rv); }