-
Notifications
You must be signed in to change notification settings - Fork 285
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: use fs::path for app #3125
base: main
Are you sure you want to change the base?
Conversation
oh nvm:
|
At this point, honestly, why really bother w/ wstring? Windows 10 & 11 make up 97% of the installs: https://gs.statcounter.com/os-version-market-share/windows/desktop/worldwide Windows 7 still hanging about 2.5% was EOL'd 5 years ago. Windows 8.1 was EOL'd 2 years ago, and has a negligible share... |
std::filesystem uses wstring for its paths. |
db49b5a
to
6c98e2c
Compare
While it does implement/provide those overloads for legacy reasons, the wstring code path is not used/seen at all if the app is running in the UTF-8 code page. |
@kmilos how do I enable this std::filesystem == std::string mode? |
@kmilos I don't think this is right. On meson, I just tried doing a build with MSVCRT:
meaning std::filesystem uses std::wstring on UCRT64. |
122a856
to
31788a8
Compare
It does on MSVCRT, but does not on UCRT.
It does not mean this. We explicitly dropped support for building on MSVCRT when we dropped wstring. |
It is already enabled on the main branch: both CMake and meson build w/ UCRT and attach the UTF-8 code page manifest to the exiv2 app and other executables. Other clients of the library are expected to do the same. See #2951 again. |
I'm specifically asking about std::filesystem. |
AFAIK, there is nothing specific about But I will confirm this once I get access to my UCRT64 machine... |
@neheb I stand corrected, apologies! It does look like (at least GNU and LLVM) std::filesystem::path is exclusively wchar_t on Windows regardless of underlying C lib (and I guess the same is w/ Visual Studio)... That makes things more complicated indeed, and not that seamless as the UTF-8 switch by UCRT promised... 😕 |
However, although the underlying type is wchar_t on Windows, it would seem the std::filesystem should still handle any conversion automagically and path can be constructed and accessed by any type: https://en.cppreference.com/w/cpp/filesystem/path/string I.e. it looks like you can't use |
Right. The whole reason wstring was brought back was to get it to compile on Windows with fs::path. Although at this point, it’s a lot of changes to action.cpp |
It was compiling just fine w/o it, the CI was green (apart from OSS-Fuzz). It was brought back for the wchar_t API to clients. |
Looks like they really went to town in C++20 w/ UTF-8 and std::filesystem breakage: https://stackoverflow.com/a/59994164 (see also the first link by the author) |
Signed-off-by: Rosen Penev <[email protected]>
This fails on both Linux and Windows. The latter is a compilation issue. I'm not sure how to fix.
Linux fails tests because sstreams add quotes around a path.
I assume the simplest way to fix that would be to use std::format and output that.