[libcxx-commits] [PATCH] D91140: [8/N] [libcxx] Fix the preexisting directory_iterator code for windows
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 10 01:41:19 PST 2020
mstorsjo created this revision.
mstorsjo added reviewers: libc++, rnk.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.
mstorsjo requested review of this revision.
The directory_iterator.cpp file did contain an incomplete, non-working implementation for windows.
Change it to use the wchar version of the APIs.
Don't set the windows specific errors from GetLastError() as code in the generic category; remap the errors to the std::errc values.
Error out cleanly on empty paths.
Invoke FindFirstFile on <directoryname>/* to actually list the entries of the directory.
If the first entry retured by FindFirstFile is to be skipped (e.g. being "." or ".."), call advance() (which calls FindNextFile and loops) which doesn't return until a valid entry is found (or the end is reached).
This contains a large-ish mapping table for mapping windows native error codes to corresponding errc constants. It's a bit unwieldy to have in filesystem_common.h, but as the things declared by that header are in an anonymous namespace there, I guess directory_iterator.cpp can't access a definition in operations.cpp or vice versa, but it has to be in the header, or moved to a non-anonymous namespace?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D91140
Files:
libcxx/src/filesystem/directory_iterator.cpp
libcxx/src/filesystem/filesystem_common.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91140.304093.patch
Type: text/x-patch
Size: 7985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201110/f2b98c1b/attachment.bin>
More information about the libcxx-commits
mailing list