Closed Bug 919772 Opened 11 years ago Closed 7 years ago

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

Categories

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

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: jsantell, Unassigned)

References

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.
Blocks: 935215
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.