nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv); if (NS_SUCCEEDED(rv)) rv = prefBranch->GetComplexValue(pref, NS_GET_IID(nsIFileSpec), (void **)_retval); return rv;
nsresult rv = nsComponentManager::CreateInstance( (const char*)NS_FILESPEC_CONTRACTID, (nsISupports*)nsnull, (const nsID&)NS_GET_IID(nsIFileSpec), (void**)value); NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a file spec."); if (!*value) return NS_ERROR_FAILURE;  char *encodedString = nsnull; rv = CopyCharPref(pref_name, &encodedString); if (NS_FAILED(rv)) return rv;  PRBool valid; (*value)->SetPersistentDescriptorString(encodedString); (*value)->IsValid(&valid); if (! valid)  (*value)->SetNativePath(encodedString);  PR_Free(encodedString); return NS_OK;
NS_IMETHODIMP nsPref::GetFilePref(const char *pref, nsIFileSpec **_retval){  nsresult rv;  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);  if (NS_SUCCEEDED(rv))    rv = prefBranch->GetComplexValue(pref, NS_GET_IID(nsIFileSpec), (void **)_retval);  return rv;}