Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use u8string in Path/File; replace Path::Append with Path::Combine #16521

Merged
merged 2 commits into from Jan 28, 2022

Conversation

Gymnasiast
Copy link
Member

No description provided.

{
#if defined(_WIN32) && !defined(__MINGW32__)
auto pathW = String::ToWideChar(path);
std::ifstream fs(pathW, std::ios::in | std::ios::binary);
#else
std::ifstream fs(std::string(path), std::ios::in | std::ios::binary);
std::ifstream fs(u8string(path), std::ios::in | std::ios::binary);
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need this ifdef anymore since we have the fs::path just create an fs::path from the path and pass it to ifstream that will handle the wide char internally.

if (b.empty())
return std::string(a);
return u8string(a);
auto aEnd = a.back();
auto bBegin = b.front();
if (Platform::IsPathSeparator(aEnd))
Copy link
Contributor

Choose a reason for hiding this comment

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

Future refactor to replace this function with return (fs::path(u8path(a)) / fs::path(u8path(b))).u8string()

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm just reading all the in's and out's of fs::path /operator and it might not be as simple as that. Will need to check all calling sites to ensure above change makes sense.

@Gymnasiast Gymnasiast added this to the v0.4.0 milestone Jan 28, 2022
@Gymnasiast Gymnasiast merged commit 7234016 into OpenRCT2:develop Jan 28, 2022
@Gymnasiast Gymnasiast deleted the refactor/path-u8string branch January 28, 2022 21:39
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.

None yet

2 participants