0

First of all I'm new here so please don't be too harsh on me :)

I'm developing an add-on for firefox with SDK. It involves clicking on a button which exports a string to a file. This works fine when the file already exists but when it is created (indirectly) by the click, its rights are set to 000 (or ---------). If I manually change the permissions with chmod, then the exportation of the string works fine.

Question: Is there a way to make the add-on create a readable file? (e.g. 660)

I guess this could be dangerous since you could create executable files on any computer... but there must be a way?!

1 Answer 1

0

I found out what the problem was. It's much more basic than I thought; I answer and let the moderators delete the question if need be.

The easiest way to set the permissions is when the file is created. In my case, the 0666 option does it:

var outputStream = Cc["@mozilla.org/network/file-output-stream;1"]
                   .createInstance(Ci.nsIFileOutputStream);
outputStream.init(file, 0x04 | 0x08 | 0x10, 0666, 0);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.