13
0

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
This commit is contained in:
Tim Mayberry 2012-06-23 05:08:04 +00:00
parent 1d3594cc9b
commit fb76229f7b
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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