зеркало из https://github.com/mozilla/pjs.git
Bug 381365 ? No default bookmarks for profiles with a non-relative profile location (r=bsmedberg)
This commit is contained in:
Родитель
c131df1b35
Коммит
347c9a224d
|
@ -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 {
|
||||
|
|
|
@ -686,30 +686,7 @@ nsToolkitProfileService::CreateProfile(nsILocalFile* aRootDir,
|
|||
return NS_ERROR_FILE_NOT_DIRECTORY;
|
||||
}
|
||||
else {
|
||||
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);
|
||||
rv = rootDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче