Skip to content
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

Option to process parent before/after contents #18

Closed
mcharsley opened this issue Jan 31, 2017 · 8 comments
Closed

Option to process parent before/after contents #18

mcharsley opened this issue Jan 31, 2017 · 8 comments

Comments

@mcharsley
Copy link
Contributor

According to the docs:

Results are returned in depth first fashion, with directories yielded before their contents

Would it be possible to have an option to yield directories after their contents. That would be useful e.g. for recursively deleting a directory.

@BurntSushi
Copy link
Owner

Would it be possible to have an option to yield directories after their contents.

This might be doable. I think it can be done without any change in memory requirements. It just requires a bit more state shuffling.

That would be useful e.g. for recursively deleting a directory.

Why can't you use std::fs::remove_dir_all?

@mcharsley
Copy link
Contributor Author

mcharsley commented Jan 31, 2017 via email

@BurntSushi
Copy link
Owner

I don't think I'll be doing this any time soon myself, but I'd be happy to review a PR. (My hope is that this is a small change, but if you think it's a large change, I'd like to discuss it in more detail first.)

@mcharsley
Copy link
Contributor Author

Done. See #19

@michaelsproul
Copy link

I didn't see this issue or PR #19, but implemented something similar this morning by storing the DirEntrys for the "deferred" directories inside the stack_list: DirList field.

My code visits each directory twice, once before and once after traversing the children:

michaelsproul@363c944

There are a bunch of clones that I should remove from my code (by making a common dir: DirEntry field on DirList), and it generally needs some polish, but I figured I'd link it to see what you think.

@mcharsley
Copy link
Contributor Author

mcharsley commented Feb 7, 2017 via email

@mcharsley
Copy link
Contributor Author

Hi. Any progress on this?

thanks

Mark

@michaelsproul
Copy link

I haven't done anything on it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants