views:

301

answers:

1

I have a Firefox extension need to write to one files inside the extension's chrome folder, it works fine on windows and linux, but it give me 0x800520015 NS_ERROR_FILE_ACCESS_DENIED error. it is very strange, I manually set the file to have write permission, it works fine then.

My question is where should I set something to tell MAC OS to give write permission to that file.

Thanks.

+2  A: 

Which "chrome" folder (post the path)? If you're talking about application's chrome folder, it's a bad idea to write there; newer Windows will not let you do that either.

[edit] so if it's in the extension, you may have the wrong permissions set in your XPI file accidentally. You can change the permissions from your extension (see nsIFile.permissions) or create a proper ZIP while packaging. (Can you post the ZIP file to verify?)

Anyway, why do you want to write to extension's folder? It's usually a bad idea.

Nickolay
~/Library/Application Support/Firefox/Profiles/[The Profile they are using]/extensions/[extension GUID]/chrome/ Where the extension installed. Thanks for the reply. It works fine in Windows and Linux.
@Nickolay, thanks a lot for the help. I need to store some information on hard drive, so I don't have to access remote servers to check every second, close to some cache file. Where is the best place to store those caches? You mean inside my extension, I can programmatically change the permission for those cache files? I am a little bit confused about the way to create a proper zip while packaging, could you please give me more detail about that? Thanks a lot.
@Nickolay, thanks a lot, I finally solved the issue by using your suggestion, set the nsIFile.permissions. Thanks a lot for the help.
"Where is the best place to store those caches?" - somewhere in the profile folder ("ProfD"), but not along with your extension's code, since it's auto-updated.
Nickolay
"confused about the way to create a proper zip while packaging" - dunno either. I would expect that zipping a folder with properly set permissions, using a permission-aware zip utility, would create a proper zip, but I don't know for sure.
Nickolay
@Nickolay, Thanks a lot for the help. I am on my way to change the cache file locations. Thanks again.