Commit 04f929fa authored by Shawn Waldon's avatar Shawn Waldon

Put pieces in a subdirectory for XMLP* readers

parent 89a96efe
......@@ -37,6 +37,8 @@ vtkXMLPDataWriter::vtkXMLPDataWriter()
this->GhostLevel = 0;
this->WriteSummaryFile = 1;
this->UseSubdirectory = false;
this->PathName = 0;
this->FileNameBase = 0;
this->FileNameExtension = 0;
......@@ -359,7 +361,12 @@ char* vtkXMLPDataWriter::CreatePieceFileName(int index, const char* path)
{
s << path;
}
s << this->FileNameBase << "_" << index;
s << this->FileNameBase;
if (this->UseSubdirectory)
{
s << "/" << this->FileNameBase;
}
s << "_" << index;
if (this->PieceFileNameExtension)
{
s << this->PieceFileNameExtension;
......@@ -382,6 +389,11 @@ int vtkXMLPDataWriter::WritePiece(int index)
pWriter->AddObserver(vtkCommand::ProgressEvent, this->ProgressObserver);
char* fileName = this->CreatePieceFileName(index, this->PathName);
std::string path = vtksys::SystemTools::GetParentDirectory(fileName);
if (path.size() > 0 && !vtksys::SystemTools::PathExists(path))
{
vtksys::SystemTools::MakeDirectory(path);
}
pWriter->SetFileName(fileName);
delete [] fileName;
......
......@@ -63,6 +63,14 @@ public:
vtkGetMacro(GhostLevel, int);
//@}
//@{
/**
* Get/Set whether to use a subdirectory to store the pieces
*/
vtkSetMacro(UseSubdirectory, bool);
vtkGetMacro(UseSubdirectory, bool);
//@}
//@{
/**
* Get/Set whether the writer should write the summary file that
......@@ -133,6 +141,7 @@ protected:
int NumberOfPieces;
int GhostLevel;
int WriteSummaryFile;
bool UseSubdirectory;
char* PathName;
char* FileNameBase;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment