summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-22 02:43:13 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-22 02:43:13 +0100
commitb3ebc84c8dfa7379a3977ed7305fd7cf7fdd8ee7 (patch)
treeb0318572f8fe94446614f398c0f75d5d28889d80
parentd41716e4cc2be229fee82d99dc84e253d7949d47 (diff)
Improved FileLocator
-rw-r--r--src/plugins/filesystem/FileLocator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/filesystem/FileLocator.cpp b/src/plugins/filesystem/FileLocator.cpp
index af5244c..6804c6d 100644
--- a/src/plugins/filesystem/FileLocator.cpp
+++ b/src/plugins/filesystem/FileLocator.cpp
@@ -131,7 +131,7 @@ bool FileLocator::doLocate(Resource &resource, const std::string &path,
base /= path;
// If we already found a fitting resource there, use that.
- if (fs::exists(base)) {
+ if (fs::exists(base) && fs::is_file(base)) {
std::string location = fs::canonical(base).generic_string();
#ifdef FILELOCATOR_DEBUG_PRINT
std::cout << "FileLocator: Found \"" << path << "\" at "
@@ -143,8 +143,8 @@ bool FileLocator::doLocate(Resource &resource, const std::string &path,
}
}
- // If the path starts with "./" only perform relative lookups!
- if (path.substr(0, 2) == "./") {
+ // If the path starts with "./" or "../" only perform relative lookups!
+ if (path.substr(0, 2) == "./" || path.substr(0, 3) == "../") {
return false;
}
@@ -159,7 +159,7 @@ bool FileLocator::doLocate(Resource &resource, const std::string &path,
#endif
fs::path p{*it};
p /= path;
- if (fs::exists(p)) {
+ if (fs::exists(p) && fs::is_file(p)) {
std::string location = fs::canonical(p).generic_string();
#ifdef FILELOCATOR_DEBUG_PRINT
std::cout << "FileLocator: Found \"" << path << "\" in "