MCPcopy Create free account
hub / github.com/SimpleITK/SimpleITK / FormatFileName

Function FormatFileName

Code/IO/src/sitkImageViewer.cxx:939–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937
938//
939std::string
940FormatFileName(const std::string & TempDirectory,
941 const std::string & name,
942 const std::string & extension,
943 const int tagID)
944{
945 std::string TempFile = TempDirectory;
946
947#ifdef _WIN32
948 int pid = _getpid();
949#else
950 int pid = getpid();
951#endif
952
953 std::ostringstream tmp;
954
955 if (!name.empty())
956 {
957 std::string n = name;
958 // remove invalid characters
959 n.erase(std::remove_if(n.begin(), n.end(), &IsBadCharacter), n.end());
960
961 tmp << n << "-" << pid << "-" << tagID;
962 TempFile = TempFile + tmp.str() + extension;
963 }
964 else
965 {
966 tmp << "TempFile-" << pid << "-" << tagID;
967 TempFile = TempFile + tmp.str() + extension;
968 }
969 return TempFile;
970}
971
972#if defined(_WIN32)
973//

Callers 1

BuildFullFileNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected