Revert to modified 3.02 binaries on Windows
To deal with issues running .vbs scripts on some systems. If the 3.02 binaries haven't been reinstalled since this version, reinstall them as 3.02a automatically or on manual upgrade to fix corrupted binaries from previous gzip issue. Other platforms unchanged
This commit is contained in:
parent
b2d5612526
commit
1e2346eba1
|
@ -182,8 +182,18 @@ Zotero_Preferences.Search = {
|
||||||
var infoIsRegistered = Zotero.Fulltext.pdfInfoIsRegistered();
|
var infoIsRegistered = Zotero.Fulltext.pdfInfoIsRegistered();
|
||||||
var bothRegistered = converterIsRegistered && infoIsRegistered;
|
var bothRegistered = converterIsRegistered && infoIsRegistered;
|
||||||
|
|
||||||
|
// On Windows, install if not installed or anything other than 3.02a
|
||||||
|
if (Zotero.isWin) {
|
||||||
|
var converterVersionAvailable = !converterIsRegistered
|
||||||
|
|| Zotero.Fulltext.pdfConverterVersion != '3.02a';
|
||||||
|
var infoVersionAvailable = !infoIsRegistered
|
||||||
|
|| Zotero.Fulltext.pdfInfoVersion != '3.02a';
|
||||||
|
var bothAvailable = converterVersionAvailable && infoVersionAvailable;
|
||||||
|
latestVersion = "3.02a";
|
||||||
|
}
|
||||||
// Install if not installed, version unknown, outdated, or
|
// Install if not installed, version unknown, outdated, or
|
||||||
// Xpdf 3.02/3.04 (to upgrade to Poppler),
|
// Xpdf 3.02/3.04 (to upgrade to Poppler),
|
||||||
|
else {
|
||||||
var converterVersionAvailable = (!converterIsRegistered ||
|
var converterVersionAvailable = (!converterIsRegistered ||
|
||||||
Zotero.Fulltext.pdfConverterVersion == 'UNKNOWN'
|
Zotero.Fulltext.pdfConverterVersion == 'UNKNOWN'
|
||||||
|| latestVersion > Zotero.Fulltext.pdfConverterVersion
|
|| latestVersion > Zotero.Fulltext.pdfConverterVersion
|
||||||
|
@ -199,6 +209,7 @@ Zotero_Preferences.Search = {
|
||||||
|| (!latestVersion.startsWith('3.02') && latestVersion != '3.04'
|
|| (!latestVersion.startsWith('3.02') && latestVersion != '3.04'
|
||||||
&& Zotero.Fulltext.pdfInfoVersion == '3.04'));
|
&& Zotero.Fulltext.pdfInfoVersion == '3.04'));
|
||||||
var bothAvailable = converterVersionAvailable && infoVersionAvailable;
|
var bothAvailable = converterVersionAvailable && infoVersionAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
// Up to date -- disable update button
|
// Up to date -- disable update button
|
||||||
if (!converterVersionAvailable && !infoVersionAvailable) {
|
if (!converterVersionAvailable && !infoVersionAvailable) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ var Zotero_RecognizePDF = new function() {
|
||||||
var {exec, args} = Zotero.Fulltext.getPDFConverterExecAndArgs();
|
var {exec, args} = Zotero.Fulltext.getPDFConverterExecAndArgs();
|
||||||
args.push('-enc', 'UTF-8', '-nopgbrk', '-layout', '-l', pages, file.path, cacheFile.path);
|
args.push('-enc', 'UTF-8', '-nopgbrk', '-layout', '-l', pages, file.path, cacheFile.path);
|
||||||
|
|
||||||
Zotero.debug("RecognizePDF: Running " + exec + " " + args.map(arg => "'" + arg + "'").join(" "));
|
Zotero.debug("RecognizePDF: Running " + exec.path + " " + args.map(arg => "'" + arg + "'").join(" "));
|
||||||
|
|
||||||
return Zotero.Utilities.Internal.exec(exec, args).then(function() {
|
return Zotero.Utilities.Internal.exec(exec, args).then(function() {
|
||||||
if(!cacheFile.exists()) {
|
if(!cacheFile.exists()) {
|
||||||
|
|
|
@ -191,7 +191,6 @@ Zotero.Fulltext = new function(){
|
||||||
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||||
|
|
||||||
Zotero.debug("Saving " + uri.spec + " to " + file.path);
|
Zotero.debug("Saving " + uri.spec + " to " + file.path);
|
||||||
var output = FileUtils.openSafeFileOutputStream(file);
|
|
||||||
NetUtil.asyncFetch(uri, function (is, status) {
|
NetUtil.asyncFetch(uri, function (is, status) {
|
||||||
if (!Components.isSuccessCode(status)) {
|
if (!Components.isSuccessCode(status)) {
|
||||||
Zotero.debug(status, 1);
|
Zotero.debug(status, 1);
|
||||||
|
@ -204,9 +203,28 @@ Zotero.Fulltext = new function(){
|
||||||
|
|
||||||
Zotero.File.putContentsAsync(file, is)
|
Zotero.File.putContentsAsync(file, is)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
// Delete if too small, since a 404 might not be detected above
|
||||||
|
if (file.fileSize < 50000) {
|
||||||
|
var msg = file.path + " is too small -- deleting";
|
||||||
|
Zotero.debug(msg, 1);
|
||||||
|
Components.utils.reportError(msg);
|
||||||
|
try {
|
||||||
|
file.remove(false);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
Zotero.debug(e, 1);
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
callback(false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var scriptExt = _getScriptExtension();
|
var scriptExt = _getScriptExtension();
|
||||||
// On Windows, write out script to hide pdftotext console window
|
// On Windows, write out script to hide pdftotext console window
|
||||||
if (tool == 'converter') {
|
// TEMP: disabled
|
||||||
|
if (false && tool == 'converter') {
|
||||||
if (Zotero.isWin) {
|
if (Zotero.isWin) {
|
||||||
var content = Zotero.File.getContentsFromURL('resource://zotero/hide.' + scriptExt);
|
var content = Zotero.File.getContentsFromURL('resource://zotero/hide.' + scriptExt);
|
||||||
var scriptFile = Zotero.getTempDirectory();
|
var scriptFile = Zotero.getTempDirectory();
|
||||||
|
@ -215,7 +233,8 @@ Zotero.Fulltext = new function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Write out output redirection script for pdfinfo
|
// Write out output redirection script for pdfinfo
|
||||||
else if (tool == 'info') {
|
// TEMP: disabled on Windows
|
||||||
|
else if (!Zotero.isWin && tool == 'info') {
|
||||||
var content = Zotero.File.getContentsFromURL('resource://zotero/redirect.' + scriptExt);
|
var content = Zotero.File.getContentsFromURL('resource://zotero/redirect.' + scriptExt);
|
||||||
var scriptFile = Zotero.getTempDirectory();
|
var scriptFile = Zotero.getTempDirectory();
|
||||||
scriptFile.append('pdfinfo.' + scriptExt);
|
scriptFile.append('pdfinfo.' + scriptExt);
|
||||||
|
@ -246,6 +265,10 @@ Zotero.Fulltext = new function(){
|
||||||
// Write the version number to a file
|
// Write the version number to a file
|
||||||
var versionFile = destDir.clone();
|
var versionFile = destDir.clone();
|
||||||
versionFile.append(fileName + '.version');
|
versionFile.append(fileName + '.version');
|
||||||
|
// TEMP
|
||||||
|
if (Zotero.isWin) {
|
||||||
|
version = '3.02a';
|
||||||
|
}
|
||||||
Zotero.File.putContents(versionFile, version + '');
|
Zotero.File.putContents(versionFile, version + '');
|
||||||
|
|
||||||
Zotero.Fulltext.registerPDFTool(tool);
|
Zotero.Fulltext.registerPDFTool(tool);
|
||||||
|
@ -327,7 +350,8 @@ Zotero.Fulltext = new function(){
|
||||||
// If scripts exist, use those instead
|
// If scripts exist, use those instead
|
||||||
switch (tool) {
|
switch (tool) {
|
||||||
case 'converter':
|
case 'converter':
|
||||||
if (Zotero.isWin) {
|
// TEMP: disabled
|
||||||
|
if (false && Zotero.isWin) {
|
||||||
var script = Zotero.getZoteroDirectory();
|
var script = Zotero.getZoteroDirectory();
|
||||||
script.append('pdftotext.' + _getScriptExtension())
|
script.append('pdftotext.' + _getScriptExtension())
|
||||||
if (script.exists()) {
|
if (script.exists()) {
|
||||||
|
|
|
@ -1604,6 +1604,29 @@ Zotero.Schema = new function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TEMP
|
||||||
|
if (Zotero.isWin) {
|
||||||
|
if (Zotero.Fulltext.pdfInfoIsRegistered()) {
|
||||||
|
if (Zotero.Fulltext.pdfInfoVersion != '3.02a') {
|
||||||
|
installInfo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Install missing component if one is installed
|
||||||
|
else if (Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||||
|
installInfo = true;
|
||||||
|
}
|
||||||
|
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||||
|
if (Zotero.Fulltext.pdfConverterVersion != '3.02a') {
|
||||||
|
installConverter = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Install missing component if one is installed
|
||||||
|
else if (Zotero.Fulltext.pdfInfoIsRegistered()) {
|
||||||
|
installConverter = true;
|
||||||
|
}
|
||||||
|
availableVersion = '3.02';
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (Zotero.Fulltext.pdfInfoIsRegistered()) {
|
if (Zotero.Fulltext.pdfInfoIsRegistered()) {
|
||||||
let currentVersion = Zotero.Fulltext.pdfInfoVersion;
|
let currentVersion = Zotero.Fulltext.pdfInfoVersion;
|
||||||
if (currentVersion < availableVersion || currentVersion.startsWith('3.02')
|
if (currentVersion < availableVersion || currentVersion.startsWith('3.02')
|
||||||
|
@ -1626,6 +1649,7 @@ Zotero.Schema = new function(){
|
||||||
else if (Zotero.Fulltext.pdfInfoIsRegistered()) {
|
else if (Zotero.Fulltext.pdfInfoIsRegistered()) {
|
||||||
installConverter = true;
|
installConverter = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let prefKey = 'pdfToolsInstallError';
|
let prefKey = 'pdfToolsInstallError';
|
||||||
let lastTry = 0, delay = 43200000; // half a day, so doubles to a day initially
|
let lastTry = 0, delay = 43200000; // half a day, so doubles to a day initially
|
||||||
|
|
Loading…
Reference in New Issue
Block a user