From bf88fb942d624f40218716d375744aa14b3406a8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 24 May 2014 16:14:08 +0200 Subject: Prevented FilesystemContext from resolving absolute paths * there are situations where one may pass absolute paths to external functions which should not be resolved against the context path ** for example when reading files found by "read-directory" through its "full" value node * this could be checked by the external functions themself ** but as this check is required by all of them it is better implemented in the FilesystemContext --- src/support/filesystem_context.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/support') diff --git a/src/support/filesystem_context.cc b/src/support/filesystem_context.cc index a30bccc..eba7e45 100644 --- a/src/support/filesystem_context.cc +++ b/src/support/filesystem_context.cc @@ -20,7 +20,13 @@ FilesystemContext::FilesystemContext(const std::string& path): boost::filesystem::path FilesystemContext::resolve( const std::string& path) const { - return absolute(this->path_ / path); + const boost::filesystem::path targetPath(path); + + if ( targetPath.is_absolute() ) { + return targetPath; + } else { + return absolute(this->path_ / targetPath); + } } boost::filesystem::path FilesystemContext::resolve( -- cgit v1.2.3