comparison OrthancServer/OrthancInitialization.cpp @ 2933:4a38d7d4f0e0

new class: OrthancConfiguration
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Nov 2018 17:08:48 +0100
parents 40131f0c25b5
children 4767d36679ed
comparison
equal deleted inserted replaced
2931:89f2c302fc37 2933:4a38d7d4f0e0
741 httpServer.RegisterUser(username.c_str(), password.c_str()); 741 httpServer.RegisterUser(username.c_str(), password.c_str());
742 } 742 }
743 } 743 }
744 744
745 745
746 std::string Configuration::InterpretRelativePath(const std::string& baseDirectory,
747 const std::string& relativePath)
748 {
749 boost::filesystem::path base(baseDirectory);
750 boost::filesystem::path relative(relativePath);
751
752 /**
753 The following lines should be equivalent to this one:
754
755 return (base / relative).string();
756
757 However, for some unknown reason, some versions of Boost do not
758 make the proper path resolution when "baseDirectory" is an
759 absolute path. So, a hack is used below.
760 **/
761
762 if (relative.is_absolute())
763 {
764 return relative.string();
765 }
766 else
767 {
768 return (base / relative).string();
769 }
770 }
771
772 std::string Configuration::InterpretStringParameterAsPath(const std::string& parameter) 746 std::string Configuration::InterpretStringParameterAsPath(const std::string& parameter)
773 { 747 {
774 boost::recursive_mutex::scoped_lock lock(globalMutex_); 748 boost::recursive_mutex::scoped_lock lock(globalMutex_);
775 return InterpretRelativePath(defaultDirectory_.string(), parameter); 749 return SystemToolbox::InterpretRelativePath(defaultDirectory_.string(), parameter);
776 } 750 }
777 751
778 752
779 void Configuration::GetGlobalListOfStringsParameter(std::list<std::string>& target, 753 void Configuration::GetGlobalListOfStringsParameter(std::list<std::string>& target,
780 const std::string& key) 754 const std::string& key)