rv = OpenRegistry(); if (NS_FAILED(rv)) return rv;  nsRegistryKey key;  rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key); if (NS_FAILED(rv)) return rv;
nsFileSpec profileDirSpec; GetProfileDir(profileName, &profileDirSpec);
NS_IMETHODIMP nsProfile::DeleteProfile(const char* profileName, PRBool canDeleteFiles){    nsresult rv = NS_OK; #if defined(DEBUG_profile)    printf("ProfileManager : DeleteProfile(%s,%s)\n", profileName, canDeleteFiles?"true":"false");#endif        rv = OpenRegistry();    if (NS_FAILED(rv)) return rv;        nsRegistryKey key;        rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key);    if (NS_FAILED(rv)) return rv;#if defined(DEBUG_profile)     printf("DeleteProfile : deleted profile -> %s <-\n", profileName);#endif    rv = ForgetCurrentProfile();    if (NS_FAILED(rv)) return rv;        // If user asks for it, delete profile directory    if (canDeleteFiles) {        nsFileSpec profileDirSpec;                rv = GetProfileDir(profileName, &profileDirSpec);        if (NS_FAILED(rv)) return rv;                rv = DeleteUserDirectories(profileDirSpec);        if (NS_FAILED(rv)) return rv;    }    // Remove the subtree from the registry.    rv = m_reg->RemoveSubtree(key, profileName);    if (NS_FAILED(rv)) return rv;        return rv;}