++j;
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 */
break;
}
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 true if a and b have the same inode */
bool
-inodes_same (const path& a, const path& b)
+equivalent_paths (const std::string& a, const std::string& b)
{
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;
- 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);
}
path_is_within (path const & haystack, path needle)
{
while (1) {
- if (inodes_same (haystack, needle)) {
+ if (equivalent_paths (haystack.to_string(), needle.to_string())) {
return true;
}
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