a file in the 'PrfDef'-dir. (e.g. '/usr/lib/thunderbird-0.9/defaults/pref') using nsIPrefService.readUserPrefs.
However, I've found out that once reading the file using readUserPrefs, preferences also get _saved_ to this file. (And not to prefs.js in the User's profile any more.)
Is there a way to read a user-preferences-file while still keeping the default location for saving the preferences?
Any help would be appreciated, --leo
PS.: The current code for preference-reading looks like that:
---------- snipp! ---------- const autoPrefsFile = 'autoprefs.js'; const DirectoryServiceContractID = "@mozilla.org/file/directory_service;1"; const nsIProperties = Components.interfaces.nsIProperties; const nsIFile = Components.interfaces.nsIFile;
function getPrefFile() {
var dirService = Components.classes[DirectoryServiceContractID].
getService(nsIProperties);
var prefDir = dirService.get('PrfDef', nsIFile);
var prefFile = prefDir.clone();
prefFile.append(autoPrefsFile);
return prefFile;
}function readAutoPrefs() {
var prefs = Components.classes[PrefServiceContractID].
getService(nsIPrefService);var prefFile = getPrefFile();
try {
prefs.readUserPrefs(prefFile);
return true;
}
catch(ex) {
displayError("Unable to read autoprefs file " + autoPrefsFile +
"\n" + ex);
return false;
}
}
---------- snipp! ----------
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom
