summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/ResourceLocator.hpp2
-rw-r--r--src/plugins/boost/FileLocator.cpp19
2 files changed, 15 insertions, 6 deletions
diff --git a/src/core/ResourceLocator.hpp b/src/core/ResourceLocator.hpp
index 926b312..39c7b30 100644
--- a/src/core/ResourceLocator.hpp
+++ b/src/core/ResourceLocator.hpp
@@ -44,6 +44,8 @@ public:
SCRIPT,
// A Type System
TYPESYS,
+ DOCUMENT,
+ ATTRIBUTES,
// TODO: Aren't documents and attribute descriptors missing?
// TODO: What is the purpose of these two?
GENERIC_MODULE,
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);