13
0

Rename PBD::sys::inodes_same to equivalent_paths

This better reflects its function and more closely matches boost
naming(which is usually a good sign)

git-svn-id: svn://localhost/ardour2/branches/3.0@12857 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2012-06-23 05:07:59 +00:00
parent 5ae32cdfd9
commit 17475df100
4 changed files with 7 additions and 7 deletions

View File

@ -277,7 +277,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
++j; ++j;
while (j != hits.end()) { while (j != hits.end()) {
if (PBD::sys::inodes_same (*i, *j)) { if (PBD::sys::equivalent_paths (*i, *j)) {
/* *i and *j are the same file; break out of the loop early */ /* *i and *j are the same file; break out of the loop early */
break; break;
} }

View File

@ -4528,7 +4528,7 @@ Session::ensure_search_path_includes (const string& path, DataType type)
On Windows, I think we could just do if (*i == path) here. On Windows, I think we could just do if (*i == path) here.
*/ */
if (PBD::sys::inodes_same (*i, path)) { if (PBD::sys::equivalent_paths (*i, path)) {
return; return;
} }
} }

View File

@ -221,12 +221,12 @@ get_absolute_path (const path & p)
/** @return true if a and b have the same inode */ /** @return true if a and b have the same inode */
bool bool
inodes_same (const path& a, const path& b) equivalent_paths (const std::string& a, const std::string& b)
{ {
struct stat bA; struct stat bA;
int const rA = g_stat (a.to_string().c_str(), &bA); int const rA = g_stat (a.c_str(), &bA);
struct stat bB; struct stat bB;
int const rB = g_stat (b.to_string().c_str(), &bB); int const rB = g_stat (b.c_str(), &bB);
return (rA == 0 && rB == 0 && bA.st_dev == bB.st_dev && bA.st_ino == bB.st_ino); return (rA == 0 && rB == 0 && bA.st_dev == bB.st_dev && bA.st_ino == bB.st_ino);
} }
@ -239,7 +239,7 @@ bool
path_is_within (path const & haystack, path needle) path_is_within (path const & haystack, path needle)
{ {
while (1) { while (1) {
if (inodes_same (haystack, needle)) { if (equivalent_paths (haystack.to_string(), needle.to_string())) {
return true; return true;
} }

View File

@ -192,7 +192,7 @@ path get_absolute_path (const path &);
bool path_is_within (const path &, path); bool path_is_within (const path &, path);
bool inodes_same (const path &, const path &); bool equivalent_paths (const std::string &, const std::string &);
} // namespace sys } // namespace sys