-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Adjusted behavior of filesystem::is_empty and filesystem::directory_iterator to work with empty volumes #4311
Conversation
…stem::directory_iterator with empty volumes
…tor__with__volume_name__fix
This comment was marked as resolved.
This comment was marked as resolved.
…e__fix' of https://github.com/MartinKuschnik/STL into fs__is_empty__and__directory_iterator__with__volume_name__fix
Hi Stephan, thanks for your advice. I'm not used to this tool chain and struggling a bit with it. After rechecking the readme, now I'm able to test in the right way instead of using the Test Explorer in Visual Studio. 😁 But I have two more questions.
|
If you select the "C++ Clang tools for Windows" component in the VS Installer, that will install the proper version of clang-format. By default it'll be installed to
In VSCode, if you open up our repo as a workspace, we automatically configure format-on-save via If you have clang-format installed but don't want to format via your editor, you can ask our build system to format the entire repo with
It seems likely that you have a production version of VS installed (17.8?). That's fine (production happily coexists with Preview) but if your Command Prompt has 17.8 on its PATH then building microsoft/STL won't work with that. You need to open up a VS Preview command prompt before working with the STL. What I do is start with a clean Command Prompt and then manually run |
Thanks for the fix - I wouldn't have known how to do this myself! 😻 I pushed a commit to address my code review comments, and I double-checked that the fix still works. After running your
#include <exception>
#include <filesystem>
#include <print>
using namespace std;
int main() {
println("_MSVC_STL_UPDATE: {}", _MSVC_STL_UPDATE);
constexpr const char* volume = R"(\\?\Volume{0b4e8604-2b5f-418d-b1b4-189ca77f2ba1}\)";
println("filesystem::exists('{}')) : {}", volume, filesystem::exists(volume));
try {
println("filesystem::is_empty('{}')) succeeded: {}", volume, filesystem::is_empty(volume));
} catch (const exception& ex) {
println("filesystem::is_empty('{}')) failed: {}", volume, ex.what());
}
try {
const filesystem::directory_iterator it(volume);
println("filesystem::directory_iterator('{}')) succeeded.", volume);
} catch (const exception& ex) {
println("filesystem::directory_iterator('{}')) failed: {}", volume, ex.what());
}
} Then reproed the bug with VS 2022 17.9 Preview 2.1:
And verified the fix:
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for giving details hints and fixing it yourself. Next time i can provide a better code based on your code review points. |
Thanks again for fixing this bug and congratulations on your first microsoft/STL commit! 🎉 😻 🛠️ This is expected to ship in VS 2022 17.10 Preview 2. |
The goal of the implementation was to fix #4291.
Following tables should explain the behavior of the current implementation in comparison to the changed code:
filesystem::is_empty(...)
filesystem::exists(...)
\\?\Volume{ecab883f-c728-474b-9b40-e90cb2834b66}\
true
ERROR
🐛true
\\?\Volume{ecab883f-c728-474b-9b40-e90cb2834b65}\
false
ERROR
ERROR
filesystem::directory_iterator(...)
filesystem::exists(...)
\\?\Volume{ecab883f-c728-474b-9b40-e90cb2834b66}\
true
ERROR
🐛empty
\\?\Volume{ecab883f-c728-474b-9b40-e90cb2834b65}\
false
ERROR
ERROR