[SG16-Unicode] filesystem::path_view::compare()

Niall Douglas s_sourceforge at nedprod.com
Fri Aug 23 14:27:14 CEST 2019


> Since different components of a path can be on different filesystems and
> different filesystems have different rules for storing path, can we
> innovate a bit here?

Sure. Using LLFIO:

bool path_equality(path_view a, path_view b)
{
  expected<file_handle, file_io_error> a = catch(file({}, a, :mode::none));
  expected<file_handle, file_io_error> b = catch(file({}, b, :mode::none));
  return a.has_value() && b.has_value() && a->unique_id() == b->unique_id();
}

This is the only feasible, and correct, way of performing filesystem
path equality comparison. This is what we ought to do.

Niall


More information about the Unicode mailing list