Closed ArthurTu closed 11 years ago
You should be able to execute the translated code in firebug console:
var zotelo_filename=('C:\cygwin\home\Arthur\test.bib');
var zotelo_id = 2;
var zotelo_translator_id = '9cb70025-a888-4a29-a210-93ec52da40d4';
var zotelo_prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch('extensions.zotero.');
var zotelo_file = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
var zotelo_recColl = zotelo_prefs.getBoolPref('recursiveCollections');
zotelo_file.initWithPath(zotelo_filename);
//split
var zotelo_zotero = Components.classes['@zotero.org/Zotero;1'].getService(Components.interfaces.nsISupports).wrappedJSObject;
var zotelo_collection = true;
var zotelo_translator = new zotelo_zotero.Translate('export');
if (zotelo_id != 0){ //not all collections
zotelo_collection = zotelo_zotero.Collections.get(zotelo_id);
zotelo_translator.setCollection(zotelo_collection);
};
//split
if(zotelo_collection){
zotelo_translator.setLocation(zotelo_file);
zotelo_translator.setTranslator(zotelo_translator_id);
zotelo_prefs.setBoolPref('recursiveCollections', true);
zotelo_translator.translate();
zotelo_prefs.setBoolPref('recursiveCollections', zotelo_recColl);
zotelo_out=':MozOK:';
}else{
zotelo_out='Collection with the id ' + zotelo_id + ' does not exist.';
};
//split
zotelo_out;
You can run this in firebug or moz-repl console on some non-cygwin path and see if it has to do with cygwin or it is some firefox or zotero bug. I have not way to investigate this issue and I would appreciate if you can figure it out.
Fixed in my pull request. This is the output of the correct code. Do notice the escape of backslashes in zotelo_filename.
zotelo message [Sun Apr 28 19:25:12 2013]
Executing command:
(moz-command (format zotelo--export-collection-js 'C:\\cygwin\\home\\Arthur\\test.bib' 2))
translated as:
var zotelo_filename=('C:\\cygwin\\home\\Arthur\\test.bib');
var zotelo_id = 2;
var zotelo_translator_id = '9cb70025-a888-4a29-a210-93ec52da40d4';
var zotelo_prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch('extensions.zotero.');
var zotelo_file = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
var zotelo_recColl = zotelo_prefs.getBoolPref('recursiveCollections');
zotelo_file.initWithPath(zotelo_filename);
//split
var zotelo_zotero = Components.classes['@zotero.org/Zotero;1'].getService(Components.interfaces.nsISupports).wrappedJSObject;
var zotelo_collection = true;
var zotelo_translator = new zotelo_zotero.Translate('export');
if (zotelo_id != 0){ //not all collections
zotelo_collection = zotelo_zotero.Collections.get(zotelo_id);
zotelo_translator.setCollection(zotelo_collection);
};
//split
if(zotelo_collection){
zotelo_translator.setLocation(zotelo_file);
zotelo_translator.setTranslator(zotelo_translator_id);
zotelo_prefs.setBoolPref('recursiveCollections', true);
zotelo_translator.translate();
zotelo_prefs.setBoolPref('recursiveCollections', zotelo_recColl);
zotelo_out=':MozOK:';
}else{
zotelo_out='Collection with the id ' + zotelo_id + ' does not exist.';
};
//split
zotelo_out;
Updating 'test.bib' ...
zotelo message [Sun Apr 28 19:25:12 2013]
Moz-command finished
zotelo message [Sun Apr 28 19:25:12 2013]
Moz-command finished
zotelo message [Sun Apr 28 19:25:12 2013]
Moz-command finished
zotelo message [Sun Apr 28 19:25:12 2013]
Moz-command finished
'test.bib' updated successfully (BibTeX)
I am using zotelo with emacs on cygwin.
I added a fix to zotelo source code to handle to file name convertion, and expected it to work.
After zotelo-update-database, error occured.