From fb76229f7b92caafee76cf1c480c62946d682b58 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sat, 23 Jun 2012 05:08:04 +0000 Subject: [PATCH] Change PBD::sys::path_is_within to take string params and use Glib git-svn-id: svn://localhost/ardour2/branches/3.0@12859 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/filesystem.cc | 8 ++++---- libs/pbd/pbd/filesystem.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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