void avtFileWriter::Write(const char *filename, avtDataObject_p dob, int quality, bool progressive, int compression, bool binary) { if (IsImageFormat()) { if (*dob == NULL) { avtCallback::IssueWarning("The file writer was not able to save " "out a NULL image."); } else { imgWriter->SetInput(dob); imgWriter->Write(imgFormat, filename, quality, progressive, compression); } } else { if (*dob == NULL) { avtCallback::IssueWarning("The file writer was not able to save " "out a NULL surface."); } else { dsWriter->SetInput(dob); dsWriter->Write(dsFormat, filename, binary); } } }
char * avtFileWriter::CreateFilename(const char *base, bool family) { char *rv = NULL; const char *msg = NULL; bool keepGoing = true; while (keepGoing) { keepGoing = false; if (IsImageFormat()) { rv = imgWriter->CreateFilename(base, family, imgFormat); } else { rv = dsWriter->CreateFilename(base, family, dsFormat); } bool fileExists = false; ifstream ifile(rv); if (!ifile.fail()) { fileExists = true; } if (fileExists && family) { // // We are saving a family, so reject this one and keep going. // msg = "Although VisIt typically saves out files sequentially, " "some numbers are being skipped when saving out this " "file to avoid overwriting previous saves."; keepGoing = true; } else { ofstream ofile(rv); if (ofile.fail()) { rv = NULL; msg = "VisIt cannot write a file in the directory specified.\n" "Note: If you are running client/server, VisIt can only " "save files onto the local client."; } } } if (msg != NULL) { avtCallback::IssueWarning(msg); } return rv; }
BOOL CPicapDoc::BuildFileList(CString newFolder) { if (m_findHandle) { FindClose(m_findHandle); m_findHandle = NULL; } newFolder += _T("\\*"); m_findHandle = FindFirstFile(newFolder, &m_findData); if (m_findHandle == INVALID_HANDLE_VALUE) { CString errorStr = INVALID_FILE_HANDLE_STR; errorStr.Format(_T("%s GetLastError reports %d"), INVALID_FILE_HANDLE_STR, GetLastError()); return FALSE; } else { m_fileList.clear(); if (IsImageFormat(m_findData.cFileName)) { m_fileList.push_back(m_findData.cFileName); } while (FindNextFile(m_findHandle, &m_findData) != 0) { if (IsImageFormat(m_findData.cFileName)) { m_fileList.push_back(m_findData.cFileName); } } FindClose(m_findHandle); m_findHandle = NULL; } return TRUE; }