changeset 6395:cf8715d1aaf0

using boost::filesystem::path in SystemToolbox::InterpretRelativePath()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Nov 2025 13:51:16 +0100
parents e0df58ca5fa5
children 55db426a8667
files OrthancFramework/Sources/SystemToolbox.cpp OrthancFramework/Sources/SystemToolbox.h
diffstat 2 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/SystemToolbox.cpp	Wed Nov 12 13:47:56 2025 +0100
+++ b/OrthancFramework/Sources/SystemToolbox.cpp	Wed Nov 12 13:51:16 2025 +0100
@@ -1029,27 +1029,25 @@
 
 
   boost::filesystem::path SystemToolbox::InterpretRelativePath(const boost::filesystem::path& baseDirectory,
-                                                               const std::string& relativePath)
+                                                               const boost::filesystem::path& relativePath)
   {
-    boost::filesystem::path relative = SystemToolbox::PathFromUtf8(relativePath);
-
     /**
        The following lines should be equivalent to this one: 
 
-       return (base / relative);
+       return (baseDirectory / relativePath);
 
        However, for some unknown reason, some versions of Boost do not
        make the proper path resolution when "baseDirectory" is an
        absolute path. So, a hack is used below.
     **/
 
-    if (relative.is_absolute())
+    if (relativePath.is_absolute())
     {
-      return relative;
+      return relativePath;
     }
     else
     {
-      return baseDirectory / relative;
+      return baseDirectory / relativePath;
     }
   }
 
--- a/OrthancFramework/Sources/SystemToolbox.h	Wed Nov 12 13:47:56 2025 +0100
+++ b/OrthancFramework/Sources/SystemToolbox.h	Wed Nov 12 13:51:16 2025 +0100
@@ -136,7 +136,7 @@
     static void GetEnvironmentVariables(std::map<std::string, std::string>& env);
 
     static boost::filesystem::path InterpretRelativePath(const boost::filesystem::path& baseDirectory,
-                                                         const std::string& relativePath);
+                                                         const boost::filesystem::path& relativePath);
 
     static void ReadFileRange(std::string& content,
                               const boost::filesystem::path& path,