-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add an API for directory iteration #323
Conversation
Signed-off-by: Scott K Logan <[email protected]>
This change adds a simple function for listing the contents of a directory, and returning the names of those files as a string_array object. Signed-off-by: Scott K Logan <[email protected]>
93331f7
to
9837765
Compare
Signed-off-by: Scott K Logan <[email protected]>
Signed-off-by: Scott K Logan <[email protected]>
Signed-off-by: Scott K Logan <[email protected]>
src/filesystem.c
Outdated
if (NULL != state->dir) { | ||
closedir(state->dir); | ||
} |
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.
TIL that closedir(NULL)
causes some sort of abort on macOS, but not on Linux.
This reverts commit 9837765. Signed-off-by: Scott K Logan <[email protected]>
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.
This is a lot of really good work; I can't see much to complain about with it.
So looks good to me with green CI. Thanks for iterating!
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.
i think it looks good with nitpick.
@Barry-Xu-2018 friendly ping, you might wanna take a look at this since we added |
I have checked codes and LGTM. |
Signed-off-by: Scott K Logan <[email protected]> Co-authored-by: tomoya <[email protected]>
This API enables iteration of large directories. There are three parts here:
It's worth discussing the reason I created the
rcutils_dir_iter_state_t
struct instead of putting more stuff inrcutils_dir_iter_t
. The biggest motivating factor there is that we needwindows.h
for those types, and I REALLY REALLY don't want that polluting our rcutils headers. Additionally, the idea behind this API is to hide the platform-specific data structures, so that stuff is essentially private data for the API.Closes #249