changeset 125:145e654112d6

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Jan 2016 17:08:44 +0100
parents f395dddfbf16
children f99adade8b77
files Orthanc/Core/Enumerations.cpp Orthanc/Core/Enumerations.h Orthanc/Core/FileStorage/FilesystemStorage.cpp Orthanc/Core/Toolbox.cpp Orthanc/Core/Toolbox.h
diffstat 5 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Orthanc/Core/Enumerations.cpp	Mon Jan 04 14:27:06 2016 +0100
+++ b/Orthanc/Core/Enumerations.cpp	Thu Jan 28 17:08:44 2016 +0100
@@ -897,7 +897,7 @@
     std::string s = specificCharacterSet;
     Toolbox::ToUpperCase(s);
 
-    // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/
+    // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
     // https://github.com/dcm4che/dcm4che/blob/master/dcm4che-core/src/main/java/org/dcm4che3/data/SpecificCharacterSet.java
     if (s == "ISO_IR 6" ||
         s == "ISO_IR 192" ||
@@ -1046,7 +1046,7 @@
 
   const char* GetDicomSpecificCharacterSet(Encoding encoding)
   {
-    // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/
+    // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
     switch (encoding)
     {
       case Encoding_Utf8:
--- a/Orthanc/Core/Enumerations.h	Mon Jan 04 14:27:06 2016 +0100
+++ b/Orthanc/Core/Enumerations.h	Thu Jan 28 17:08:44 2016 +0100
@@ -314,7 +314,8 @@
   };
 
 
-  // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/
+  // Specific Character Sets
+  // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
   enum Encoding
   {
     Encoding_Ascii,
@@ -338,7 +339,7 @@
   };
 
 
-  // https://www.dabsoft.ch/dicom/3/C.7.6.3.1.2/
+  // http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.3.1.2
   enum PhotometricInterpretation
   {
     PhotometricInterpretation_ARGB,  // Retired
--- a/Orthanc/Core/FileStorage/FilesystemStorage.cpp	Mon Jan 04 14:27:06 2016 +0100
+++ b/Orthanc/Core/FileStorage/FilesystemStorage.cpp	Thu Jan 28 17:08:44 2016 +0100
@@ -165,7 +165,7 @@
     {
       for (fs::recursive_directory_iterator current(root_), end; current != end ; ++current)
       {
-        if (fs::is_regular_file(current->status()))
+        if (Toolbox::IsRegularFile(current->path().string()))
         {
           try
           {
--- a/Orthanc/Core/Toolbox.cpp	Mon Jan 04 14:27:06 2016 +0100
+++ b/Orthanc/Core/Toolbox.cpp	Thu Jan 28 17:08:44 2016 +0100
@@ -127,6 +127,7 @@
   }
 #endif
 
+
   void Toolbox::USleep(uint64_t microSeconds)
   {
 #if defined(_WIN32)
@@ -208,7 +209,7 @@
   void Toolbox::ReadFile(std::string& content,
                          const std::string& path) 
   {
-    if (!boost::filesystem::is_regular_file(path))
+    if (!IsRegularFile(path))
     {
       LOG(ERROR) << std::string("The path does not point to a regular file: ") << path;
       throw OrthancException(ErrorCode_RegularFileExpected);
@@ -268,7 +269,7 @@
   {
     if (boost::filesystem::exists(path))
     {
-      if (boost::filesystem::is_regular_file(path))
+      if (IsRegularFile(path))
       {
         boost::filesystem::remove(path);
       }
@@ -1382,5 +1383,26 @@
     return static_cast<int>(getpid());
 #endif
   }
+
+
+  bool Toolbox::IsRegularFile(const std::string& path)
+  {
+    namespace fs = boost::filesystem;
+
+    try
+    {
+      if (fs::exists(path))
+      {
+        fs::file_status status = fs::status(path);
+        return (status.type() == boost::filesystem::regular_file ||
+                status.type() == boost::filesystem::reparse_file);   // Fix BitBucket issue #11
+      }
+    }
+    catch (fs::filesystem_error&)
+    {
+    }
+
+    return false;
+  }
 }
 
--- a/Orthanc/Core/Toolbox.h	Mon Jan 04 14:27:06 2016 +0100
+++ b/Orthanc/Core/Toolbox.h	Thu Jan 28 17:08:44 2016 +0100
@@ -190,5 +190,7 @@
                     const std::string& prefix);
 
     int GetProcessId();
+
+    bool IsRegularFile(const std::string& path);
   }
 }