diff OrthancServer/OrthancInitialization.cpp @ 429:09b3c6265a94

unit test for fedora 18 problem
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 08 May 2013 15:13:01 +0200
parents 6f00823be12a
children f746592d8301
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp	Wed May 08 13:06:04 2013 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Wed May 08 15:13:01 2013 +0200
@@ -280,32 +280,40 @@
   }
 
 
-  std::string InterpretStringParameterAsPath(const std::string& parameter)
+  std::string InterpretRelativePath(const std::string& baseDirectory,
+                                    const std::string& relativePath)
   {
-    boost::mutex::scoped_lock lock(globalMutex_);
+    boost::filesystem::path base(baseDirectory);
+    boost::filesystem::path relative(relativePath);
+
+    return (base / relative).string();
 
     /**
        The following lines should be equivalent to this one: 
 
-       return (defaultDirectory_ / parameter).string();
+       return (base / relative).string();
 
        However, for some unknown reason, some versions of Boost do not
-       make the proper path resolution when "defaultDirectory_" is an
+       make the proper path resolution when "baseDirectory" is an
        absolute path. So, a hack is used below.
      **/
 
-    boost::filesystem::path p(parameter);
-
-    if (p.is_absolute())
+    if (relative.is_absolute())
     {
-      return p.string();
+      return relative.string();
     }
     else
     {
-      return (defaultDirectory_ / parameter).string();
+      return (base / relative).string();
     }
   }
 
+  std::string InterpretStringParameterAsPath(const std::string& parameter)
+  {
+    boost::mutex::scoped_lock lock(globalMutex_);
+    return InterpretRelativePath(defaultDirectory_.string(), parameter);
+  }
+
 
   void GetGlobalListOfStringsParameter(std::list<std::string>& target,
                                        const std::string& key)