sdk/io/fs functions do not work with relative paths

RESOLVED INCOMPLETE

Status

P2
normal
RESOLVED INCOMPLETE
6 years ago
a year ago

People

(Reporter: jsantell, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

In node's fs module, relative paths work with their functions:

`fs.writeFileSync('here.txt', 'content')`

Which would write to $PWD/here.txt. The same does not work in our SDK, as it needs an absolute path, since it is ultimately passed into an nsILocalFile, nsIFileOutputStream, or other similar functions.
What would you evaluate it relative to?
node does it relative to `__dirname` -- not sure if we can do something similar, especially with a xpi'd addon.
I don't know what __dirname is. Unless fs can read inside xpi files then making it relative to main.js wouldn't make sense. Neither would making it relative to the XPI really. Relative to the profile is about the only thing I can think of.
Priority: -- → P2
Blocks: 935215
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.