diff options
author | don bright <hugh.m.bright@gmail.com> | 2012-08-18 16:38:24 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2012-08-18 16:38:24 (GMT) |
commit | 47a06c074fa6321224d5c6d6cc85bf9336fb8765 (patch) | |
tree | 9c1bcb078963477d522ece5a42dab106dd87b03a /src/parsersettings.cc | |
parent | d87dd4821561fffec4d875a7f584fc25100b8d75 (diff) |
detect flaws in 'use' and 'include' statements. make locate_file consider directories as 'non files'.
Diffstat (limited to 'src/parsersettings.cc')
-rw-r--r-- | src/parsersettings.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parsersettings.cc b/src/parsersettings.cc index 53b34f4..9409add 100644 --- a/src/parsersettings.cc +++ b/src/parsersettings.cc @@ -15,13 +15,13 @@ void add_librarydir(const std::string &libdir) /*! Searces for the given file in library paths and returns the full path if found. - Returns an empty path if file cannot be found. + Returns an empty path if file cannot be found or filename is a directory. */ std::string locate_file(const std::string &filename) { BOOST_FOREACH(const std::string &dir, librarypath) { fs::path usepath = fs::path(dir) / filename; - if (fs::exists(usepath)) return usepath.string(); + if (fs::exists(usepath) && !fs::is_directory(usepath)) return usepath.string(); } return std::string(); } |