Karl Ove Hufthammer wrote:
>
> Is it possible to overwrite files in the user's profile directory
> using XPIs? (If yes, then how?)
Yes, getFolder() function supports "Profile" as an argument, and returns a
folder object that refers to the current profile. It's not possible to
iterate over all profiles though.
> What I want to do is replace the user's bookmark file with another
> (localized) bookmark file.
Please think hard before doing this evil action, which would remove the
English default bookmarks but would also remove any personal bookmarks the
user has saved.
Maybe an "addBookmark" command in the XPI language would be better (I'm not
volunteering!). You could add new localized bookmarks, but it would leave
the user's existing stuff alone and they could delete the English stuff by
hand if they want (after all, they were happy enough to have installed
English in the first place).
Maybe I'm misunderstanding your context and goal.
If you're sure it's the right thing, it would be very easy to do...
err = addFile("","newbkmark.html",getFolder("Profile"),"bookmarks.html");
In 4.x, however, it was possible for the user to rename their bookmark file
and put it in another location. If that's still true then the above wouldn't
help you with anyone who put their bookmarks in a non-default location.
I guess that points out a need for the install script to be able to read and
set preferences, too.
-Dan Veditz