nsProfile::RenameProfile(const PRUnichar* oldName, const PRUnichar* newName)
NS_IMETHODIMP nsProfile::RenameProfile(const char* oldName, const char* newName)
nsProfile::RenameProfile(const PRUnichar* oldName, const PRUnichar* newName){    NS_ENSURE_ARG_POINTER(oldName);       NS_ENSURE_ARG_POINTER(newName);       nsresult rv = NS_OK;#if defined(DEBUG_profile)    {      printf("ProfileManager : Renaming profile\n");      nsCAutoString temp1; temp1.AssignWithConversion(oldName);      printf("Old name:  %s\n", NS_STATIC_CAST(const char*, temp1));      nsCAutoString temp2; temp2.AssignWithConversion(newName);      printf("New name:  %s\n", NS_STATIC_CAST(const char*, temp2));    }#endif    PRBool exists;    rv = ProfileExists(newName, &exists);    if (NS_FAILED(rv)) return rv;        // That profile already exists...    if (exists) {#if defined(DEBUG_profile)          printf("ProfileManager : Rename Operation failed : Profile exists. Provide a different new name for profile.\n");#endif        return NS_ERROR_FAILURE;    }    // Copy reg keys    rv = CopyRegKey(oldName, newName);    if (NS_FAILED(rv)) return rv;         // Delete old profile entry    rv = DeleteProfile(oldName, PR_FALSE /* don't delete files */);    if (NS_FAILED(rv)) return rv;     	/* note, we do not rename the directory on disk to the new name	 * this is on purpose.     *	 * we don't require the directory name to match the profile name, 	 * but it usually does.  	 * (the pairing of values occurs in the profile registry)	 * 	 * Imagine this scenario:	 * 1) user creates a profile "foo" and the directory gets named "foo". 	 * 2) user creates a profile "bar" and the directory gets named "bar"	 * 3) user deletes the profile "foo", but chooses not to delete the files on disk.  (they are given this option when deleting a profile)	 * 4) user renames "bar" profile to "foo", but still uses the directory named "bar" on disk	 *	 * bad things would happen if we tried to rename the directory	 */        rv = ForgetCurrentProfile();    if (NS_FAILED(rv)) return rv;    gProfileDataAccess->mProfileDataChanged = PR_TRUE;    gProfileDataAccess->UpdateRegistry(nsnull);    return NS_OK;}