Closed Bug 935189 Opened 11 years ago Closed 11 years ago

Use OS.File to remove directories recursively

Categories

(Toolkit :: Add-ons Manager, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: mossop, Assigned: mossop)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Now the dependant bugs are fixed we can remove a bunch of unnecessary code.
Attached patch patch rev 1Splinter Review
Having different OS.File methods depending on whether we're removing a directory is a little annoying and I'd rather test and call the right one rather than assume since if this goes wrong all sorts of things break.
Attachment #827709 - Flags: review?(bmcbride)
Comment on attachment 827709 [details] [diff] [review]
patch rev 1

Review of attachment 827709 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/mozapps/extensions/XPIProvider.jsm
@@ +1387,2 @@
>      }
>      catch (e if e instanceof OS.File.Error && e.becauseNoSuchFile) {

Don't need this try/catch anymore either, as both methods support an ignoreAbsent flag.

AFAIK that flag is meant to default to true, but it currently defaults to false for removeDir() - filed bug 935792.
Attachment #827709 - Flags: review?(bmcbride) → review-
Comment on attachment 827709 [details] [diff] [review]
patch rev 1

(In reply to Blair McBride [:Unfocused] from comment #2)
> Comment on attachment 827709 [details] [diff] [review]
> patch rev 1
> 
> Review of attachment 827709 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: toolkit/mozapps/extensions/XPIProvider.jsm
> @@ +1387,2 @@
> >      }
> >      catch (e if e instanceof OS.File.Error && e.becauseNoSuchFile) {
> 
> Don't need this try/catch anymore either, as both methods support an
> ignoreAbsent flag.
> 
> AFAIK that flag is meant to default to true, but it currently defaults to
> false for removeDir() - filed bug 935792.

It's still needed for the OS.File.stat call I can pull the remove calls outside of the try...catch block and set ignoreAbsent on them if you want though
Attachment #827709 - Flags: review- → review?(bmcbride)
Comment on attachment 827709 [details] [diff] [review]
patch rev 1

Review of attachment 827709 [details] [diff] [review]:
-----------------------------------------------------------------

Oh, duh.
Attachment #827709 - Flags: review?(bmcbride) → review+
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/7cefaf69392d
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: