1

Say I'm writing a Firefox extension/add-on and I've got some user data stored in a file (XML or RDF format) in the user's profile directory. I want to use that data as a datasource for a XUL template. Is there a way to refer to the file in a safe, cross-platform manner?

My only idea so far, based on all the reading I've done, is to start with an "rdf:null" datasource in the XUL and replace the datasources attribute in the code, after using the FileUtils to get the path to the profile directory. Is this the only way?

big_m
  • 1,408
  • 1
  • 12
  • 24
  • I guess, it's more how you look into it. According to XUL, the secure way ofaccessing a list of files using RDF. I have used just a file reader from a folder inside chrome folder & externally too using File utilities. Ref for RDF:http://www-archive.mozilla.org/rdf/doc/xul-template-reference.html – linguini Feb 11 '13 at 09:18
  • possible duplicate of [Select A File Within Firefox Add-On Directory](http://stackoverflow.com/questions/24900845/select-a-file-within-firefox-add-on-directory) – Paul Sweatte Nov 27 '14 at 01:50
  • It doesn't seem so, @PaulSweatte. I was asking about how to access a file in the user's profile directory, not one within the add-on package. – big_m Dec 02 '14 at 21:59
  • The add-on directory is within the user's [profile directory](http://kb.mozillazine.org/Profile_folder_-_Firefox), which enables each profile to have different add-ons. As a result, the [file i/o process](http://kb.mozillazine.org/Profile_folder_-_Firefox#Using_the_JavaScript_or_Error_Console) is the same. – Paul Sweatte Dec 03 '14 at 01:07
  • Ah, OK. I'll have to take a closer look then. In any case, IIRC (it's been a while), I didn't have a problem getting the path from JavaScript; my question was about making the reference from XUL, so I still don't think the questions are the same. – big_m Dec 03 '14 at 05:48

0 Answers0