2 * (C) Copyright 2004-2007 Shawn Betts
3 * (C) Copyright 2007-2008 John J. Foerch
4 * (C) Copyright 2007-2008 Jeremy Maitin-Shepard
6 * Use, modification, and distribution are subject to the terms specified in the
10 function load_rc_file(file)
14 if (typeof file == "string")
19 subscript_loader.loadSubScript("file://" + name, conkeror);
25 function load_rc_directory (file_o) {
26 var entries = file_o.directoryEntries;
28 while (entries.hasMoreElements ()) {
29 var entry = entries.getNext ();
30 entry.QueryInterface (Ci.nsIFile);
31 if (entry.leafName.match(/^[^.].*\.js$/i)) {
35 files.sort(function (a, b) {
36 if (a.leafName < b.leafName) {
38 } else if (a.leafName > b.leafName) {
44 for (var i = 0; i < files.length; i++) {
45 load_rc_file(files[i]);
51 * path_s: string path to load. may be a file, a directory, or null.
52 * if it is a file, that file will be loaded. if it is a directory,
53 * all `.js' files in that directory will be loaded. if it is null,
54 * the preference `conkeror.rcfile' will be read for the default.
56 function load_rc(path_s)
60 if (pref_has_user_value("conkeror.rcfile")) {
61 var rcfile = get_pref("conkeror.rcfile");
71 var file_o = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
72 file_o.initWithPath(path_s);
73 if (file_o.isDirectory()) {
74 load_rc_directory (file_o);
76 load_rc_file (path_s);
80 require_later("command-line.js");
82 call_after_load("command-line.js", function () {
83 command_line_param_handler("l", false, function (path) {
86 } catch (e) { dump_error(e); }