comparison Core/TemporaryFile.cpp @ 3508:70524b4acc72

Name of temporary files now include the process ID to ease design of scripts cleaning /tmp
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Aug 2019 11:41:26 +0200
parents 5d1f5984dc41
children 94f4a18a79cc
comparison
equal deleted inserted replaced
3507:69e49fc044f8 3508:70524b4acc72
61 { 61 {
62 dir = temporaryDirectory; 62 dir = temporaryDirectory;
63 } 63 }
64 64
65 // We use UUID to create unique path to temporary files 65 // We use UUID to create unique path to temporary files
66 std::string filename = "Orthanc-" + Orthanc::Toolbox::GenerateUuid(); 66 const std::string uuid = Orthanc::Toolbox::GenerateUuid();
67
68 // New in Orthanc 1.5.8: Prefix the process ID to the name of the
69 // temporary files, in order to locate orphan temporary files that
70 // were left by instances of Orthanc that exited in non-clean way
71 // https://groups.google.com/d/msg/orthanc-users/MSJX53bw6Lw/d3S3lRRLAwAJ
72 std::string filename = "Orthanc-" + boost::lexical_cast<std::string>(SystemToolbox::GetProcessId()) + "-" + uuid;
67 73
68 if (extension != NULL) 74 if (extension != NULL)
69 { 75 {
70 filename.append(extension); 76 filename.append(extension);
71 } 77 }