NS_IMETHODIMP nsProfile::DeleteProfile(const char* profileName)
NS_IMETHODIMP nsProfile::DeleteProfile(const char* profileName, PRBool canDeleteFiles)
NS_IMETHODIMP nsProfile::DeleteProfile(const char* profileName){    nsresult rv = NS_OK;#if defined(DEBUG_profile)    printf("ProfileManager : DeleteProfile\n");#endif    	// To be more uniform need to change the arragement	// of the following with NS_SUCCEEDED()	// Check result.    if ( m_reg != nsnull ) 	{        // Latch onto the registry object.        NS_ADDREF(m_reg);        // Open the registry.        rv = m_reg->Open();        if (NS_FAILED(rv))        {			#if defined(DEBUG_profile)				printf("Error opening Registry.\n" );			#endif            return rv;        }				#if defined(DEBUG_profile)			printf("Registry opened OK.\n" );		#endif        nsIRegistry::Key key;        rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &key);        if (NS_FAILED(rv))        {			#if defined(DEBUG_profile)				printf("Can't obtain subtree Profiles.\n" );			#endif            return rv;        }		// Remove the subtree from the registry.        rv = m_reg->RemoveSubtree(key, profileName);        if (NS_FAILED(rv))           return rv;		else		{			#if defined(DEBUG_profile) 				printf("DeleteProfile : deleted profile -> %s <-\n", profileName);			#endif		}		// May need to delete directories, but not so directly.		// DeleteUserDirectories(profileDirSpec);		// Take care of the current profile, if the profile 		// just deleted was a current profile.		if (!renameCurrProfile)		{			char *oldCurrProfile = nsnull;			char *newCurrProfile = nsnull;			GetCurrentProfile(&oldCurrProfile);			if (PL_strcmp(profileName, oldCurrProfile) == 0)			{				GetFirstProfile(&newCurrProfile);				#if defined(DEBUG_profile) 					printf("DeleteProfile : Old Current profile -> %s <-\n", oldCurrProfile);					printf("DeleteProfile : New Current profile -> %s <-\n", newCurrProfile);				#endif				rv = m_reg->SetString(key, "CurrentProfile", newCurrProfile);			    if (NS_FAILED(rv)) 				{				   #if defined(DEBUG_profile) 					   printf("Did not take nsnull successfully\n");			       #endif				}			}		}        m_reg->Close();    }    return rv;}