macFile->SetFileCreator((OSType)aMacType);
macFile->SetFileType((OSType)aMacType);
nsSaveMsgListener::OnStartRequest(nsIRequest* request, nsISupports* aSupport){    nsresult rv = NS_OK;    if (m_fileSpec)        rv = m_fileSpec->GetOutputStream(getter_AddRefs(m_outputStream));    if (NS_FAILED(rv) && m_messenger)    {        m_messenger->Alert("saveAttachmentFailed");    }    else if (!m_dataBuffer)    {        m_dataBuffer = (char*) PR_CALLOC(FOUR_K+1);    }    #if defined(XP_MAC) || defined(XP_MACOSX)  if (!m_contentType.IsEmpty())  {    nsFileSpec realSpec;    m_fileSpec->GetFileSpec(&realSpec);    // Create nsILocalFile from a nsFileSpec.    nsCOMPtr<nsILocalFile> outputFile;    NS_FileSpecToIFile(&realSpec, getter_AddRefs(outputFile));  	/* if we are saving an appledouble or applesingle attachment, we need to use an Apple File Decoder */    if ((nsCRT::strcasecmp(m_contentType.get(), APPLICATION_APPLEFILE) == 0) ||        (nsCRT::strcasecmp(m_contentType.get(), MULTIPART_APPLEDOUBLE) == 0))    {                    nsCOMPtr<nsIAppleFileDecoder> appleFileDecoder = do_CreateInstance(NS_IAPPLEFILEDECODER_CONTRACTID, &rv);      if (NS_SUCCEEDED(rv) && appleFileDecoder)      {        rv = appleFileDecoder->Initialize(m_outputStream, outputFile);        if (NS_SUCCEEDED(rv))          m_outputStream = do_QueryInterface(appleFileDecoder, &rv);      }    }    else    {      /* we need to set the correct application type and creator base on the content-type */      nsCOMPtr<nsIMIMEService> mimeService (do_GetService(NS_MIMESERVICE_CONTRACTID));      if (mimeService)      {        nsCOMPtr<nsIMIMEInfo> mimeinfo;        if (NS_SUCCEEDED(mimeService->GetFromMIMEType(m_contentType.get(), getter_AddRefs(mimeinfo))))        {          PRUint32 aMacType;          PRUint32 aMacCreator;          if (NS_SUCCEEDED(mimeinfo->GetMacType(&aMacType)) && NS_SUCCEEDED(mimeinfo->GetMacCreator(&aMacCreator)))          {            nsCOMPtr<nsILocalFileMac> macFile =  do_QueryInterface(outputFile, &rv);            if (NS_SUCCEEDED(rv) && macFile)            {              macFile->SetFileCreator((OSType)aMacCreator);              macFile->SetFileCreator((OSType)aMacType);            }          }        }      }          }  }#endif    return rv;}