Bug 411353 ? Default bookmarks and Smart folder missing from New Profile (r=bsmedberg, a=revert)

This commit is contained in:
dietrich@mozilla.com 2008-01-08 18:23:31 -08:00
parent e5419df5fb
commit 55db0fc388

View File

@ -686,7 +686,30 @@ nsToolkitProfileService::CreateProfile(nsILocalFile* aRootDir,
return NS_ERROR_FILE_NOT_DIRECTORY;
}
else {
rv = rootDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
nsCOMPtr<nsIFile> profileDefaultsDir;
nsCOMPtr<nsIFile> 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);
NS_ENSURE_SUCCESS(rv, rv);
}