Skip to content

Move TSM's u8 reader/writer into til::io#15329

Merged
DHowett merged 5 commits intomainfrom
dev/duhowett/til_fileio
Jul 17, 2024
Merged

Move TSM's u8 reader/writer into til::io#15329
DHowett merged 5 commits intomainfrom
dev/duhowett/til_fileio

Conversation

@DHowett
Copy link
Member

@DHowett DHowett commented May 10, 2023

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

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)
Copy link
Member

@lhecker lhecker May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat! I should probably do this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you still want to do this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I DO I AM JUST LAZY

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

we may be too lazy to do this after all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IT ME
I'M THE LAZY ONE

@DHowett DHowett marked this pull request as ready for review May 11, 2023 20:40
@carlos-zamora carlos-zamora assigned lhecker and unassigned lhecker Jun 9, 2023
@carlos-zamora carlos-zamora added the Needs-Second It's a PR that needs another sign-off label Jun 9, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Second It's a PR that needs another sign-off label Jun 9, 2023
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me gusta

Copy link
Member Author

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't block my own review.

Copy link
Member Author

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve - need lhecker or cazamor to approve

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo! 🎉 Thanks for taking this to the finish line

@DHowett DHowett added this pull request to the merge queue Jul 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 16, 2024
@zadjii-msft zadjii-msft added this pull request to the merge queue Jul 16, 2024
@DHowett DHowett removed this pull request from the merge queue due to a manual request Jul 17, 2024
@DHowett DHowett merged commit 49a2943 into main Jul 17, 2024
@DHowett DHowett deleted the dev/duhowett/til_fileio branch July 17, 2024 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants