MCPcopy Create free account
hub / github.com/Kitware/VTK / SplitFileName

Method SplitFileName

IO/XML/vtkXMLCompositeDataWriter.cxx:500–533  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

498
499//------------------------------------------------------------------------------
500void vtkXMLCompositeDataWriter::SplitFileName()
501{
502 std::string fileName = this->FileName;
503 std::string name;
504
505 // Split the file name and extension from the path.
506 std::string::size_type pos = fileName.find_last_of("/\\");
507 if (pos != std::string::npos)
508 {
509 // Keep the slash in the file path.
510 this->Internal->FilePath = fileName.substr(0, pos + 1);
511 name = fileName.substr(pos + 1);
512 }
513 else
514 {
515 this->Internal->FilePath = "./";
516 name = fileName;
517 }
518
519 // Split the extension from the file name.
520 pos = name.find_last_of('.');
521 if (pos != std::string::npos)
522 {
523 this->Internal->FilePrefix = name.substr(0, pos);
524 }
525 else
526 {
527 this->Internal->FilePrefix = name;
528
529 // Since a subdirectory is used to store the files, we need to
530 // change its name if there is no file extension.
531 this->Internal->FilePrefix += "_data";
532 }
533}
534
535//------------------------------------------------------------------------------
536const char* vtkXMLCompositeDataWriter::GetFilePrefix()

Callers 1

RequestDataMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected