attach link to file file picker
I'm using Zotero Standalone 3.08 on Kubuntu 12.04.1. I save pdf files of journal articles to a particular directory. Then I use "attach link to file..." in Zotero to attach them to the corresponding entries in my library. Every time I do this Zotero's file picker defaults to a "Recently Used" list of files so I have to browse to the directory I want. Is there any way to set a default directory for attaching links to files or perhaps set it to use the last used directory?
the function is called:
addAttachmentFromDialog
looks like it just defaults to a mozilla file picker, so not sure how much can be done there.
The Firefox file picker documentation at https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIFilePicker makes it look like setting fp.displayDirecotry in https://github.com/zotero/zotero/blob/master/chrome/content/zotero/zoteroPane.js would do the trick.
I'm not a developer but I think I can figure out how to get zoteroPane.js set to the directory I want. It would be nice if I could get it to read preferences and then use either the last used directory or a specified directory dependending on the preference.
But if you submit a pull request that gets it working (at least after a selection) on Linux, we'll take it. I don't think a user pref is necessary.
I set
fp.displayDirectory = "/home/joines/Documents/papers"
in zotero-standalone-build/modules/zotero/chrome/content/zotero/zoteroPane.js and then built it. It didn't work as "attach link to file" still defaults to the "Recently Used" list in the file picker.
the standard way of contributing to software hosted on github or other git repositories.
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
to this:
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var nsILocalFile= Components.interfaces.nsILocalFile;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
var f = Components.classes["@mozilla.org/file/local;1"].createInstance(nsILocalFile);
f.initWithPath("/home/jason/Documents/academics/papers");
fp.displayDirectory = f;
Both Firefox and Zotero use the GTK FileChooser if the ui.allow_platform_file_picker preference is set to true. The GTK FileChooser is supplying the annoying "Recently Used" list and defaulting to it in the open dialog. Somehow, Firefox overrides this and defaults to the last used directory. If I can find out how Firefox does this, Zotero should be able to do it as well.
If ui.allow_platform_file_picker is set to false, an XUL file picker is used which seems to always default to my home directory. This is a bit less annoying than the "Recently Used" list but requires just as many extra clicks to get where I need to go.