nsCOMPtr<nsIFileSpec> newSpec; rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(newSpec));
nsIFileSpec* newSpec = NS_LocateFileOrDirectory( nsSpecialFileSpec::App_DefaultUserProfileRoot50);
NS_IMETHODIMP nsProfile::MigrateProfile(const char* profileName, PRBool showProgressAsModalWindow){	nsresult rv = NS_OK;#if defined(DEBUG_profile)	printf("Inside Migrate Profile routine.\n" );#endif	nsFileSpec oldProfDir;	nsFileSpec newProfDir;	rv = GetProfileDir(profileName, &oldProfDir);	if (NS_FAILED(rv)) return rv;		// Create new profile dir path    NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);	if (NS_FAILED(rv) || !locator) return NS_ERROR_FAILURE;	    // Get current profile, make the new one a sibling...	nsCOMPtr<nsIFileSpec> newSpec;    rv = locator->GetFileLocation(nsSpecialFileSpec::App_DefaultUserProfileRoot50, getter_AddRefs(newSpec));	if (!newSpec)        return NS_ERROR_FAILURE;    newSpec->GetFileSpec(&newProfDir);	newProfDir += profileName;	// Call migration service to do the work.	nsCOMPtr <nsIPrefMigration> pPrefMigrator;	rv = nsComponentManager::CreateInstance(kPrefMigrationCID,                                           nsnull,					NS_GET_IID(nsIPrefMigration),					getter_AddRefs(pPrefMigrator));    if (NS_FAILED(rv)) return rv;            nsXPIDLCString oldProfDirStr;    nsXPIDLCString newProfDirStr;	    if (!newProfDir.Exists()) {	newProfDir.CreateDirectory();    }    rv = GetStringFromSpec(newProfDir, getter_Copies(newProfDirStr));    if (NS_FAILED(rv)) return rv;        if (!oldProfDir.Exists()) {	oldProfDir.CreateDirectory();    }    rv = GetStringFromSpec(oldProfDir, getter_Copies(oldProfDirStr));    if (NS_FAILED(rv)) return rv;    rv = pPrefMigrator->AddProfilePaths(oldProfDirStr,  newProfDirStr);  // you can do this a bunch of times.    rv = pPrefMigrator->ProcessPrefs(showProgressAsModalWindow);	if (NS_FAILED(rv)) return rv;    rv = OpenRegistry();    if (NS_FAILED(rv)) return rv;        	//unmark migrate flag    nsRegistryKey key;        rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key);        if (NS_SUCCEEDED(rv))        {            nsRegistryKey newKey;            rv = m_reg->GetSubtree(key, profileName, &newKey);                        if (NS_SUCCEEDED(rv))                {                    rv = m_reg->SetString( newKey, REGISTRY_MIGRATED_STRING, REGISTRY_YES_STRING);                                        if (NS_SUCCEEDED(rv))						{							rv = m_reg->SetString(key, REGISTRY_CURRENT_PROFILE_STRING, profileName);                            							if (NS_FAILED(rv))                                {#if defined(DEBUG_profile)									printf("Profiles : Couldn't set CurrentProfile Name.\n");#endif                                }						}                    else						{#if defined(DEBUG_profile)                            printf("Profiles : Couldn't set migrate flag.\n");#endif						}                    SetProfileDir(profileName, newProfDir);                }            else                {#if defined(DEBUG_profile)                    printf("Profiles : Couldn't get profileName subtree.\n");#endif                }        }    return rv;}