google / fuzztest

Other
731 stars 74 forks source link

Fix the conversion from file paths to strings in the remote_file library. #1235

Closed copybara-service[bot] closed 4 months ago

copybara-service[bot] commented 4 months ago

Fix the conversion from file paths to strings in the remote_file library.

On Windows, the underlying value_type of std::filesystem::path is wchar_t, so there is no conversion from a path to std::string_view via calls to c_str(), and there is no implicit conversion to std::string. Instead, we now explicitly call string() to perform the conversion.

This creates a temporary string, so we can no longer simply store a string view to it in LocalRemoteFile. So I changed the member type to std::string. (Keeping a string view as a data member was dangerous anyway, since it created an undocumented assumption that the path object had to outlive the file handle.)