diff --git a/libs/pbd/filesystem.cc b/libs/pbd/filesystem.cc index 09579cf3cc..58e1a37a72 100644 --- a/libs/pbd/filesystem.cc +++ b/libs/pbd/filesystem.cc @@ -235,15 +235,15 @@ equivalent_paths (const std::string& a, const std::string& b) * @return true if it is. */ bool -path_is_within (path const & haystack, path needle) +path_is_within (std::string const & haystack, std::string needle) { while (1) { - if (equivalent_paths (haystack.to_string(), needle.to_string())) { + if (equivalent_paths (haystack, needle)) { return true; } - needle = needle.branch_path (); - if (needle.to_string().empty() || needle.to_string() == "/") { + needle = Glib::path_get_dirname (needle); + if (needle == "." || needle == "/") { break; } } diff --git a/libs/pbd/pbd/filesystem.h b/libs/pbd/pbd/filesystem.h index 68fa310930..d37011a864 100644 --- a/libs/pbd/pbd/filesystem.h +++ b/libs/pbd/pbd/filesystem.h @@ -190,7 +190,7 @@ std::string extension (const path& p); path get_absolute_path (const path &); -bool path_is_within (const path &, path); +bool path_is_within (const std::string &, std::string); /** * @return true if p1 and p2 both resolve to the same file