Closed Bug 1660328 Opened 4 years ago Closed 4 years ago

Implement directory iterator for IOUtils

Categories

(Toolkit Graveyard :: OS.File, enhancement)

enhancement

Tracking

(firefox82 fixed)

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: mail, Assigned: mail)

References

Details

Attachments

(1 file)

IOUtils does not currently implement a directory iterator. It would be great to support asynchronous iteration over directory entries.

For idiomatic directory iteration, this might require support for web IDL's async iterables.

Depends on: 1577383
Blocks: 1649598

@barret points out that rather than making a new instantiable async directory iteratory, we can probably just add a method like the following to IOUtils:

namespace IOUtils {
  Promise<Sequence<DOMString>> getChildren(DOMString path);
}

which would be used as for (const dirEntry of await IOUtils.getChildren(DOMString path)), removing the need for async iterable support for this feature.

No longer depends on: 1577383

This change introduces a getChildren method to the IOUtils interface, which
returns an array of absolute paths pointing to the immediate children of a
directory.

This method should provide equivalent functionality to creating a new
OS.File.DirectoryIterator.

Depends on D87873

Assignee: nobody → krourke
Status: NEW → ASSIGNED
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ff95badf90e3 Implement IOUtils::getChildren method r=barret,Gijs

Hm, I've reordered the commits in the patchset that @barret tried to land yesterday. These failures aren't related to this bug, but rather to changes I made to address bug 1649595.

We can try to reland this change today, while I investigate the CrashMonitor unit test failures.

Flags: needinfo?(krourke)
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f154c83412cf Implement IOUtils::getChildren method r=barret,Gijs

This was a result of an error with rebasing some of my patches, sorry! Fixed in patch D87875 :)

Flags: needinfo?(mail)
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a9bdc86cff7 Implement IOUtils::getChildren method r=barret,Gijs
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5943b631af6e Implement IOUtils::getChildren method r=barret,Gijs
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
Flags: needinfo?(mail)
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: