Show file path instead of "(null)" when installing style via file open

And fix deprecation warning from passing an nsIFile

(Also updates the Zotero.Styles.install() documentation to note that the
first parameter's `file` property can be a string path.)
This commit is contained in:
Dan Stillman 2017-12-08 00:04:00 -05:00
parent 045f1fbb7e
commit 9a43b53ebe
2 changed files with 6 additions and 5 deletions

View file

@ -269,10 +269,11 @@ Zotero.Styles = new function() {
/** /**
* Installs a style file, getting the contents of an nsIFile and showing appropriate * Installs a style file, getting the contents of an nsIFile and showing appropriate
* error messages * error messages
* @param {Object} style An object with one of the following properties * @param {Object} style - An object with one of the following properties
* - file: An nsIFile representing a style on disk * - file: An nsIFile or string path representing a style on disk
* - url: A url of the location of the style (local or remote) * - path: A string path
* - string: A string containing the style data * - url: A url of the location of the style (local or remote)
* - string: A string containing the style data
* @param {String} origin The origin of the style, either a filename or URL, to be * @param {String} origin The origin of the style, either a filename or URL, to be
* displayed in dialogs referencing the style * displayed in dialogs referencing the style
* @param {Boolean} [silent=false] Skip prompts * @param {Boolean} [silent=false] Skip prompts

View file

@ -623,7 +623,7 @@ ZoteroCommandLineHandler.prototype = {
if(file.leafName.substr(-4).toLowerCase() === ".csl" if(file.leafName.substr(-4).toLowerCase() === ".csl"
|| file.leafName.substr(-8).toLowerCase() === ".csl.txt") { || file.leafName.substr(-8).toLowerCase() === ".csl.txt") {
// Install CSL file // Install CSL file
Zotero.Styles.install(file); Zotero.Styles.install({ file: file.path }, file.path);
} else { } else {
// Ask before importing // Ask before importing
var checkState = { var checkState = {