Skip to content

Commit

Permalink
Give our fsyspath an operator std::string() conversion method.
Browse files Browse the repository at this point in the history
This is redundant (but harmless) on a Posix system, but it fills a missing
puzzle piece on Windows. The point of fsyspath is to be able to interchange
freely between fsyspath and std::string. Existing fsyspath could be
constructed and assigned from std::string, and we could explicitly call its
string() method to get a std::string, but an implicit fsyspath-to-string
conversion that worked on Posix would trip us up on Windows. Fix that.
  • Loading branch information
nat-goodspeed committed Jun 28, 2024
1 parent 982ea7f commit fbeff6d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions indra/llcommon/fsyspath.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class fsyspath: public std::filesystem::path

// shadow base-class string() method with UTF-8 aware method
std::string string() const { return super::u8string(); }
// On Posix systems, where value_type is already char, this operator
// std::string() method shadows the base class operator string_type()
// method. But on Windows, where value_type is wchar_t, the base class
// doesn't have operator std::string(). Provide it.
operator std::string() const { return string(); }
};

#endif /* ! defined(LL_FSYSPATH_H) */

0 comments on commit fbeff6d

Please sign in to comment.