This matches what MS STL returns; in std::filesystem, forward slashes is considered a generic dir separator that is valid on all platforms.
Details
- Reviewers
amccarth EricWF curdeius ldionne - Group Reviewers
Restricted Project - Commits
- rGf4f5fb915104: [libcxx] Make generic_*string return paths with forward slashes on windows
Diff Detail
Event Timeline
libcxx/include/filesystem | ||
---|---|---|
1252 | Hmmm. Why can't it be implemented in terms of generic_string? | |
1253–1254 | If I'm not mistaken it means that you traverse the string twice, once in u8string() to convert it using _CVT, and then in replace(). |
libcxx/include/filesystem | ||
---|---|---|
1252 | Because before C++20 (before char8_t), there's no typename that specifically triggers UTF8 output; if requesting output as char, it's produced in the current windows narrow code page, which in most cases isn't UTF8. | |
1253–1254 | Yep, that's a correct observation. Suboptimal, but I wouldn't want to complicate things even further (especially at this point of the patchset) for that cause - at this point, getting it to work (at all) and correctly is the only priority... |
Thanks for reviewing!
libcxx/include/filesystem | ||
---|---|---|
1253–1254 | I can add a note in a comment acknowledging this - I think that's the suitable amount of bureacracy for the issue. |
Rebased, added a comment pointing out suboptimal cases of iterating over the strings twice.
Hmmm. Why can't it be implemented in terms of generic_string?
I.e.: { return generic_string<typename __u8_string::value_type>(); }