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
Use u8string in Path/File; replace Path::Append with Path::Combine #16521
Conversation
src/openrct2/core/File.cpp
Outdated
{ | ||
#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); |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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.
3148745
to
e87beb8
Compare
e87beb8
to
3ea0e2f
Compare
No description provided.