Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
428:6f00823be12a | 429:09b3c6265a94 |
---|---|
278 httpServer.RegisterUser(username.c_str(), password.c_str()); | 278 httpServer.RegisterUser(username.c_str(), password.c_str()); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 std::string InterpretStringParameterAsPath(const std::string& parameter) | 283 std::string InterpretRelativePath(const std::string& baseDirectory, |
284 { | 284 const std::string& relativePath) |
285 boost::mutex::scoped_lock lock(globalMutex_); | 285 { |
286 boost::filesystem::path base(baseDirectory); | |
287 boost::filesystem::path relative(relativePath); | |
288 | |
289 return (base / relative).string(); | |
286 | 290 |
287 /** | 291 /** |
288 The following lines should be equivalent to this one: | 292 The following lines should be equivalent to this one: |
289 | 293 |
290 return (defaultDirectory_ / parameter).string(); | 294 return (base / relative).string(); |
291 | 295 |
292 However, for some unknown reason, some versions of Boost do not | 296 However, for some unknown reason, some versions of Boost do not |
293 make the proper path resolution when "defaultDirectory_" is an | 297 make the proper path resolution when "baseDirectory" is an |
294 absolute path. So, a hack is used below. | 298 absolute path. So, a hack is used below. |
295 **/ | 299 **/ |
296 | 300 |
297 boost::filesystem::path p(parameter); | 301 if (relative.is_absolute()) |
298 | 302 { |
299 if (p.is_absolute()) | 303 return relative.string(); |
300 { | 304 } |
301 return p.string(); | 305 else |
302 } | 306 { |
303 else | 307 return (base / relative).string(); |
304 { | 308 } |
305 return (defaultDirectory_ / parameter).string(); | 309 } |
306 } | 310 |
311 std::string InterpretStringParameterAsPath(const std::string& parameter) | |
312 { | |
313 boost::mutex::scoped_lock lock(globalMutex_); | |
314 return InterpretRelativePath(defaultDirectory_.string(), parameter); | |
307 } | 315 } |
308 | 316 |
309 | 317 |
310 void GetGlobalListOfStringsParameter(std::list<std::string>& target, | 318 void GetGlobalListOfStringsParameter(std::list<std::string>& target, |
311 const std::string& key) | 319 const std::string& key) |