return NS_OK;
GetCurrentProfile(&currProfile);    if (currProfile) { if (PL_strcmp(oldName, currProfile) == 0) { renameCurrProfile = PR_TRUE;  #if defined(DEBUG_profile) printf("ProfileManager : Renaming the current profile\n"); #endif } }   CopyRegKey(oldName, newName);   DeleteProfile(oldName, "false");    if (renameCurrProfile) { rv = m_reg->OpenDefault();  if (NS_SUCCEEDED(rv)) { nsIRegistry::Key profileRootKey;  rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &profileRootKey);  if (NS_SUCCEEDED(rv)) { rv = m_reg->SetString(profileRootKey, "CurrentProfile", newName); } m_reg->Close(); } renameCurrProfile = PR_FALSE; } return rv;
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;             /* profile is just replaced. But Keep up the count */    gProfileDataAccess->mNumProfiles++;    rv = ForgetCurrentProfile();    if (NS_FAILED(rv)) return rv;    gProfileDataAccess->mProfileDataChanged = PR_TRUE;    gProfileDataAccess->UpdateRegistry();    return NS_OK;}