Move TSM's u8 reader/writer into til::io#15329
Conversation
This allows us to remove ExportFile (?) from the API surface of CascadiaSettings (???). It will probably result in a small code size increase, but maybe we'll save that by making the .winmd smaller. :P
src/inc/til/io.h
Outdated
| } | ||
|
|
||
| // Same as read_file_as_utf8_string, but returns an empty optional, if the file couldn't be opened. | ||
| _TIL_INLINEPREFIX std::optional<std::string> read_file_as_utf8_string_if_exists(const std::filesystem::path& path, const bool elevatedOnly, FILETIME* lastWriteTime) |
There was a problem hiding this comment.
Checking all calls to read_file_as_utf8_string_if_exists all of them follow up with a .value_or(std::string{}). I think we should just return a std::string.
Furthermore I found that there's only a single caller to read_file_as_utf8_string. That caller doesn't care if the file could not be found. As such it can be replaced with a call to read_file_as_utf8_string_if_exists and we could just check if the returned string is empty.
This drops the need for having 2 variants of this function.
There was a problem hiding this comment.
neat! I should probably do this
DHowett
left a comment
There was a problem hiding this comment.
I can't block my own review.
DHowett
left a comment
There was a problem hiding this comment.
approve - need lhecker or cazamor to approve
carlos-zamora
left a comment
There was a problem hiding this comment.
Woo! 🎉 Thanks for taking this to the finish line

This allows us to remove ExportFile (?) from the API surface of CascadiaSettings (???).
It will probably result in a small code size increase, but maybe we'll save that by making the .winmd smaller. :P