Closed Bug 565694 Opened 15 years ago Closed 15 years ago

Add mkpath and rmdir to jetpack-core/file

Categories

(Add-on SDK Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Simple storage needs to create and remove directories. file.mkdir() creates a directory, creating subdirectories first if needed, and rmdir() removes an empty directory. (Simple storage also needs to access the profile directory. I almost added file.profileDir() to this patch, but maybe we should give more thought to exposing the directory service in its entirety?)
Attachment #445135 - Flags: review?(avarma)
Comment on attachment 445135 [details] [diff] [review] patch >diff --git a/packages/jetpack-core/docs/file.md b/packages/jetpack-core/docs/file.md >+<code>file.**mkdir**(*path*)</code> >+ >+Makes a new directory named by the given path. Any subdirectories that do not >+exist are also created. `mkdir` can be called multiple times on the same path. >+ I'm wondering if we actually want to call this mkpath() instead of mkdir(), simply because the convention of functions/commands called mkdir() is to *not* create subdirectories that don't exist. Perl and Python both have functions called mkpath() that does create intermediate subdirectories... Either way, not really a big deal, you can ignore this suggestion if you like. It would probably be weird to have a file.mkpath() and file.rmdir(), but no file.mkdir() or file.rmpath(), I suppose. Other than that, this looks great!
Attachment #445135 - Flags: review?(avarma) → review+
Attached patch patch v2Splinter Review
Thanks Atul, good idea. This patch renames mkdir to mkpath. I've left rmdir alone for now. If a rmpath would come in handy later, we can add it.
Attachment #445135 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Summary: Add mkdir and rmdir to jetpack-core/file → Add mkpath and rmdir to jetpack-core/file
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product. To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: