diff 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
line wrap: on
line diff
--- a/Core/TemporaryFile.cpp	Wed Aug 28 16:54:00 2019 +0200
+++ b/Core/TemporaryFile.cpp	Thu Aug 29 11:41:26 2019 +0200
@@ -63,7 +63,13 @@
     }
 
     // We use UUID to create unique path to temporary files
-    std::string filename = "Orthanc-" + Orthanc::Toolbox::GenerateUuid();
+    const std::string uuid = Orthanc::Toolbox::GenerateUuid();
+
+    // New in Orthanc 1.5.8: Prefix the process ID to the name of the
+    // temporary files, in order to locate orphan temporary files that
+    // were left by instances of Orthanc that exited in non-clean way
+    // https://groups.google.com/d/msg/orthanc-users/MSJX53bw6Lw/d3S3lRRLAwAJ
+    std::string filename = "Orthanc-" + boost::lexical_cast<std::string>(SystemToolbox::GetProcessId()) + "-" + uuid;
 
     if (extension != NULL)
     {