//------------------------------------------------------------------ // Equal to operator //------------------------------------------------------------------ bool FileSpec::operator== (const FileSpec& rhs) const { if (m_filename == rhs.m_filename) { if (m_directory == rhs.m_directory) return true; // TODO: determine if we want to keep this code in here. // The code below was added to handle a case where we were // trying to set a file and line breakpoint and one path // was resolved, and the other not and the directory was // in a mount point that resolved to a more complete path: // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling // this out... if (IsResolved() && rhs.IsResolved()) { // Both paths are resolved, no need to look further... return false; } FileSpec resolved_lhs(*this); // If "this" isn't resolved, resolve it if (!IsResolved()) { if (resolved_lhs.ResolvePath()) { // This path wasn't resolved but now it is. Check if the resolved // directory is the same as our unresolved directory, and if so, // we can mark this object as resolved to avoid more future resolves m_is_resolved = (m_directory == resolved_lhs.m_directory); } else return false; } FileSpec resolved_rhs(rhs); if (!rhs.IsResolved()) { if (resolved_rhs.ResolvePath()) { // rhs's path wasn't resolved but now it is. Check if the resolved // directory is the same as rhs's unresolved directory, and if so, // we can mark this object as resolved to avoid more future resolves rhs.m_is_resolved = (m_directory == resolved_rhs.m_directory); } else return false; } // If we reach this point in the code we were able to resolve both paths // and since we only resolve the paths if the basenames are equal, then // we can just check if both directories are equal... return resolved_lhs.GetDirectory() == resolved_rhs.GetDirectory(); } return false; }