if (server) rv = server->GetLocalPath(&localPath);  nsFilePath dirPath(localPath, PR_TRUE); nsFileSpec dirSpec(dirPath);  result = localPath; result.CreateDirectory();
if (server) { rv = server->GetLocalPath(&localPath);  if (NS_SUCCEEDED(rv)) { nsFilePath dirPath(localPath, PR_TRUE); nsFileSpec dirSpec(dirPath);  result = localPath; result.CreateDirectory(); PL_strfree(localPath); } }
nsGetImapRoot(const char* hostname, nsFileSpec &result){    nsresult rv = NS_OK; 	NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);     if (NS_FAILED(rv)) return rv;	nsCOMPtr<nsIMsgAccountManager> accountManager;	rv = session->GetAccountManager(getter_AddRefs(accountManager));    if(NS_FAILED(rv)) return rv;    nsCOMPtr<nsISupportsArray> servers;    rv = accountManager->FindServersByHostname(hostname,                                               nsIImapIncomingServer::GetIID(),                                               getter_AddRefs(servers));    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsISupports> aSupport = getter_AddRefs(servers->ElementAt(0));    nsCOMPtr<nsIMsgIncomingServer> server(do_QueryInterface(aSupport));    char *localPath = nsnull;    if (server)		rv = server->GetLocalPath(&localPath);    nsFilePath dirPath(localPath, PR_TRUE);    nsFileSpec dirSpec(dirPath); // recursive create the parent directory    result = localPath;    result.CreateDirectory();    return rv;}