1 sdump('D_TRACE','Loading file.js\n');
3 var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
4 getService( Components.interfaces.nsIProperties );
6 function create_input_stream(file) {
8 if (typeof(file)=='string') file = get_file( file );
9 var f = Components.classes["@mozilla.org/network/file-input-stream;1"]
10 .createInstance(Components.interfaces.nsIFileInputStream);
11 if (file && file.exists()) {
12 f.init(file, 0x01, 0, 0);
13 var s = Components.classes["@mozilla.org/scriptableinputstream;1"]
14 .createInstance(Components.interfaces.nsIScriptableInputStream);
26 function create_output_stream(file) {
28 if (typeof(file)=='string') file = get_file( file );
29 var f = Components.classes["@mozilla.org/network/file-output-stream;1"]
30 .createInstance(Components.interfaces.nsIFileOutputStream);
32 if (! file.exists()) file.create( 0, 0640 );
33 f.init(file, 0x02 | 0x08 | 0x20, 0644, 0);
42 function get_file( fname ) {
44 file = dirService.get( "AChrom", Components.interfaces.nsIFile );
45 file.append(mw.myPackageDir); file.append("content"); file.append("conf"); file.append(fname);
46 sdump('D_FILE','get_file( ' + fname + ').path = ' + file.path + '\n');
47 alert('get_file( ' + fname + ').path = ' + file.path + '\n');