Re: [PATCH v2] [GSoC] remove_subtree(): reimplement using iterators
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Mar 25, 2017, 12:29 UTC
- Message-ID
- <CACsJy8Dxh-QPBBLfaFWPAWUsbA9GVXA7x+mXLjEvYKhk1zOpig@mail.gmail.com>
- In-Reply-To
- <CAEA2_RK=zMwKeidPDS9u5Ep1htb3TUeOqJ6Cfd644ira4DeXaA@mail.gmail.com>
On Sat, Mar 25, 2017 at 7:13 PM, Daniel Ferreira (theiostream) <bnmvco@gmail.com> wrote:
Show 10 quoted lines
> You are correct, which shows that since all tests pass, we need to > come up with better cases for this function. > > As for a solution, I believe that the best way to go for it is to > dir_iterator's implementation to have an "Option to iterate over > directory paths before vs. after their contents" (something predicted > in the commit that created it). If it iterates over directories after > all of its contents (currently it does so before) we just need to > check if the entry is a directory and if so, rmdir() it. Does that > make sense?
Yes. However since this is a microproject, intended to be done quickly just to get you familiarize with the community and the process, I suggest you look for another readdir() place that can be easily converted to using dir-iterator first so you could go through the whole thing. But of course I will not object you improving dir-iterator and clean remove_subtree() up ;-)
-- Duy