[PALEMOON] Remove the NS_APP_BOOKMARKS_50_FILE directory service key

pull/1/head
NTD 4 years ago committed by Roy Tam
parent 07667373c4
commit fda68c9bfe
  1. 52
      application/palemoon/components/dirprovider/DirectoryProvider.cpp

@ -34,57 +34,7 @@ NS_IMPL_ISUPPORTS(DirectoryProvider,
NS_IMETHODIMP
DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
{
nsresult rv;
*aResult = nullptr;
// NOTE: This function can be reentrant through the NS_GetSpecialDirectory
// call, so be careful not to cause infinite recursion.
nsCOMPtr<nsIFile> file;
char const* leafName = nullptr;
if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) {
leafName = "bookmarks.html";
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
nsCString path;
rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
if (NS_SUCCEEDED(rv)) {
NS_NewNativeLocalFile(path, true, getter_AddRefs(file));
}
}
}
else {
return NS_ERROR_FAILURE;
}
nsDependentCString leafstr(leafName);
nsCOMPtr<nsIFile> parentDir;
if (file) {
rv = file->GetParent(getter_AddRefs(parentDir));
if (NS_FAILED(rv))
return rv;
}
else {
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(parentDir));
if (NS_FAILED(rv))
return rv;
rv = parentDir->Clone(getter_AddRefs(file));
if (NS_FAILED(rv))
return rv;
file->AppendNative(leafstr);
}
*aPersist = true;
NS_ADDREF(*aResult = file);
return NS_OK;
return NS_ERROR_FAILURE;
}
static void

Loading…
Cancel
Save