summaryrefslogtreecommitdiff
path: root/src/plugins/boost
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-12 10:37:23 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-12 10:37:23 +0100
commit5fde58b21baa7d92194c7910a85ab542a61897a9 (patch)
tree2903e9b0a5bbbbd6b1130e17f6d7813af3ed60f3 /src/plugins/boost
parentf4c635eb43575c68a77d21ba6de2a8bd1d5a49c5 (diff)
Made the relativeTo handling in FileLocator.cpp somewhat more sophisticated.
Diffstat (limited to 'src/plugins/boost')
-rw-r--r--src/plugins/boost/FileLocator.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/plugins/boost/FileLocator.cpp b/src/plugins/boost/FileLocator.cpp
index ed9d0c9..3db214f 100644
--- a/src/plugins/boost/FileLocator.cpp
+++ b/src/plugins/boost/FileLocator.cpp
@@ -42,13 +42,20 @@ ResourceLocator::Location FileLocator::locate(const std::string &path,
const Type type) const
{
boost::filesystem::path base(relativeTo);
- // use the / operator to append the path.
- base /= path;
- // if we already found a fitting resource there, use that.
if (boost::filesystem::exists(base)) {
- std::string location =
- boost::filesystem::canonical(base).generic_string();
- return ResourceLocator::Location(true, *this, type, location);
+ // look if 'relativeTo' is a directory already.
+ if (!boost::filesystem::is_directory(base)) {
+ // if not we use the parent directory.
+ base = base.parent_path();
+ }
+ // use the / operator to append the path.
+ base /= path;
+ // if we already found a fitting resource there, use that.
+ if (boost::filesystem::exists(base)) {
+ std::string location =
+ boost::filesystem::canonical(base).generic_string();
+ return ResourceLocator::Location(true, *this, type, location);
+ }
}
// otherwise look in the search paths.
auto it = searchPaths.find(type);