CreateUserDirectories(tmpDir);  if (NS_FAILED(rv)) { #if defined(DEBUG_profile) printf("Couldn't set directory property.\n" ); #endif }     rv = m_reg->SetString( newKey, "migrated", "yes"); } else { #if defined(DEBUG_profile) printf("NULL value received for directory name.\n" ); #endif } } else { #if defined(DEBUG_profile) printf("Profiles : Could not add profile name subtree.\n" ); #endif } } else { #if defined(DEBUG_profile) printf("Registry : Couldn't get Profiles subtree.\n"); #endif }  rv = m_reg->SetString(key, "CurrentProfile", profileName);  if (NS_FAILED(rv)) { #if defined(DEBUG_profile) printf("Couldn't set CurrentProfile name.\n" ); #endif } m_reg->Close(); } else { #if defined(DEBUG_profile) printf("Couldn't open registry.\n"); #endif }  } else { #if defined(DEBUG_profile) printf("Registry Object is NULL.\n"); #endif  return NS_ERROR_FAILURE; }
nsresult nsProfile::SetProfileDir(const PRUnichar *profileName, nsIFile *profileDir){    NS_ENSURE_ARG(profileName);    NS_ENSURE_ARG(profileDir);       nsresult rv = NS_OK;     // Need to ensure that this directory exists    PRBool exists;    rv = profileDir->Exists(&exists);    if (NS_SUCCEEDED(rv) && !exists)        rv = profileDir->Create(nsIFile::DIRECTORY_TYPE, 0700);    if (NS_FAILED(rv))         return rv;        nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(profileDir));    NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE);                    ProfileStruct* aProfile = new ProfileStruct();    NS_ENSURE_TRUE(aProfile, NS_ERROR_OUT_OF_MEMORY);    aProfile->profileName = profileName;    aProfile->SetResolvedProfileDir(localFile);    aProfile->isMigrated = PR_TRUE;    aProfile->isImportType = PR_FALSE;    // convert "now" from microsecs to millisecs    PRInt64 oneThousand = LL_INIT(0, 1000);    PRInt64 nowInMilliSecs = PR_Now();    LL_DIV(aProfile->creationTime, nowInMilliSecs, oneThousand);     gProfileDataAccess->SetValue(aProfile);        delete aProfile;    return rv;}