rv = gProfileDataAccess->GetValue(profileName, &aProfile); if (NS_FAILED(rv)) return rv;
if (NS_SUCCEEDED(rv)) { nsIRegistry::Key key;
NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **profileDir){    NS_ENSURE_ARG(profileName);       NS_ENSURE_ARG_POINTER(profileDir);    *profileDir = nsnull;    nsresult rv = NS_OK;#if defined(DEBUG_profile_verbose)    printf("ProfileManager : GetProfileDir\n");#endif    ProfileStruct    *aProfile;    rv = gProfileDataAccess->GetValue(profileName, &aProfile);    if (NS_FAILED(rv)) return rv;	if (aProfile == nsnull)		return NS_ERROR_FAILURE;    nsCOMPtr<nsILocalFile>aProfileDir;    rv = aProfile->GetResolvedProfileDir(getter_AddRefs(aProfileDir));    if (NS_SUCCEEDED(rv) && aProfileDir)    {#ifdef XP_MAC        PRBool exists;        rv = aProfileDir->Exists(&exists);        if (NS_FAILED(rv)) return rv;        if (exists) {            PRBool inTrash;            nsCOMPtr<nsIFile> trashFolder;                                        rv = NS_GetSpecialDirectory(NS_MAC_TRASH_DIR, getter_AddRefs(trashFolder));            if (NS_FAILED(rv)) return rv;            rv = trashFolder->Contains(aProfileDir, PR_TRUE, &inTrash);            if (NS_FAILED(rv)) return rv;            if (inTrash) {                aProfileDir = nsnull;                rv = NS_ERROR_FILE_NOT_FOUND;            }          }#endif        *profileDir = aProfileDir;        NS_IF_ADDREF(*profileDir);    }    	delete aProfile;    return rv;}