rv = filePicker->SetDefaultString(leafName.get());
rv = filePicker->SetDefaultString(leafName);
GetFileNameForPrintSettings(nsIPrintSettings* aPS){  // for testing#ifdef DEBUG_rods  return NS_OK;#endif  nsresult rv;  nsCOMPtr<nsIFilePicker> filePicker = do_CreateInstance("@mozilla.org/filepicker;1", &rv);  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIStringBundle> bundle;  rv = bundleService->CreateBundle(NS_ERROR_GFX_PRINTER_BUNDLE_URL, getter_AddRefs(bundle));  NS_ENSURE_SUCCESS(rv, rv);  nsXPIDLString title;  rv = bundle->GetStringFromName(NS_LITERAL_STRING("PrintToFile").get(), getter_Copies(title));  NS_ENSURE_SUCCESS(rv, rv);  rv = filePicker->Init(nsnull, title.get(), nsIFilePicker::modeSave);  NS_ENSURE_SUCCESS(rv, rv);   rv = filePicker->AppendFilters(nsIFilePicker::filterAll);  NS_ENSURE_SUCCESS(rv, rv);  PRUnichar* fileName;  aPS->GetToFileName(&fileName);  if (fileName) {    if (*fileName) {      nsAutoString leafName;      nsCOMPtr<nsILocalFile> file(do_CreateInstance("@mozilla.org/file/local;1"));      if (file) {        rv = file->InitWithPath(nsDependentString(fileName));        if (NS_SUCCEEDED(rv)) {          file->GetLeafName(leafName);          filePicker->SetDisplayDirectory(file);        }      }      if (!leafName.IsEmpty()) {        rv = filePicker->SetDefaultString(leafName.get());      }      NS_ENSURE_SUCCESS(rv, rv);    }    nsMemory::Free(fileName);  }  PRInt16 dialogResult;  filePicker->Show(&dialogResult);  if (dialogResult == nsIFilePicker::returnCancel) {    return NS_ERROR_ABORT;  }  nsCOMPtr<nsILocalFile> localFile;  rv = filePicker->GetFile(getter_AddRefs(localFile));  NS_ENSURE_SUCCESS(rv, rv);    if (dialogResult == nsIFilePicker::returnReplace) {    // be extra safe and only delete when the file is really a file    PRBool isFile;    rv = localFile->IsFile(&isFile);    if (NS_SUCCEEDED(rv) && isFile) {      rv = localFile->Remove(PR_FALSE /* recursive delete */);      NS_ENSURE_SUCCESS(rv, rv);    }  }  nsAutoString unicodePath;  rv = localFile->GetPath(unicodePath);  NS_ENSURE_SUCCESS(rv,rv);  if (unicodePath.IsEmpty()) {    rv = NS_ERROR_ABORT;  }  if (NS_SUCCEEDED(rv)) aPS->SetToFileName(unicodePath.get());  return rv;}