From 5a6f1eef639ffa7a426e268c9c79afaf87c8579a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 27 Nov 2016 00:06:02 -0500 Subject: [PATCH] Update deprecated uses of Zotero.getZoteroDirectory()/getZoteroDatabase() The Zotero.DataDirectory equivalents return string paths instead of nsIFile instances, so some of these calls now just use Zotero.File.pathToFile(), which can be removed when the surrounding code is updated to OS.File, --- chrome/content/zotero/overlay.js | 3 +- .../zotero/preferences/preferences_sync.js | 9 +-- chrome/content/zotero/recognizePDF.js | 2 +- chrome/content/zotero/xpcom/attachments.js | 36 +++------- chrome/content/zotero/xpcom/cite.js | 2 +- chrome/content/zotero/xpcom/db.js | 68 ++++++++++--------- chrome/content/zotero/xpcom/fulltext.js | 9 ++- chrome/content/zotero/xpcom/ipc.js | 4 +- chrome/content/zotero/xpcom/locateManager.js | 2 +- chrome/content/zotero/xpcom/schema.js | 2 +- chrome/content/zotero/xpcom/sync/syncLocal.js | 2 +- chrome/content/zotero/xpcom/zotero.js | 27 ++++---- test/content/support.js | 17 +++-- test/tests/fulltextTest.js | 2 +- test/tests/storageLocalTest.js | 2 +- test/tests/syncLocalTest.js | 2 +- 16 files changed, 88 insertions(+), 101 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 580bba828..eb4c7427e 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -229,8 +229,7 @@ var ZoteroOverlay = new function() ZoteroPane.makeVisible(); // Warn about unsafe data directory on first display - let dataDir = Zotero.getZoteroDirectory(); - Zotero.DataDirectory.checkForUnsafeLocation(dataDir.path); // async + Zotero.DataDirectory.checkForUnsafeLocation(Zotero.DataDirectory.dir); // async // Make sure tags splitter isn't missing for people upgrading from <2.0b7 document.getElementById('zotero-tags-splitter').collapsed = false; diff --git a/chrome/content/zotero/preferences/preferences_sync.js b/chrome/content/zotero/preferences/preferences_sync.js index 8c6ad507e..6196ae604 100644 --- a/chrome/content/zotero/preferences/preferences_sync.js +++ b/chrome/content/zotero/preferences/preferences_sync.js @@ -181,7 +181,7 @@ Zotero_Preferences.Sync = { ); if (index == 0) { if (check.value) { - var resetDataDirFile = OS.Path.join(Zotero.getZoteroDirectory().path, 'reset-data-directory'); + var resetDataDirFile = OS.Path.join(Zotero.DataDirectory.dir, 'reset-data-directory'); yield Zotero.File.putContentsAsync(resetDataDirFile, ''); yield Zotero.Sync.Runner.deleteAPIKey(); @@ -645,9 +645,10 @@ Zotero_Preferences.Sync = { Zotero.DB.skipBackup = true; - var file = Zotero.getZoteroDirectory(); - file.append('restore-from-server'); - Zotero.File.putContents(file, ''); + yield Zotero.File.putContentsAsync( + OS.Path.join(Zotero.DataDirectory.dir, 'restore-from-server'), + '' + ); var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING); var index = ps.confirmEx( diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js index 09a81198c..6042ca0ea 100644 --- a/chrome/content/zotero/recognizePDF.js +++ b/chrome/content/zotero/recognizePDF.js @@ -141,7 +141,7 @@ var Zotero_RecognizePDF = new function() { * @return {Promise} */ function _extractText(file, pages) { - var cacheFile = Zotero.getZoteroDirectory(); + var cacheFile = Zotero.File.pathToFile(Zotero.DataDirectory.dir); cacheFile.append("recognizePDFcache.txt"); if(cacheFile.exists()) { cacheFile.remove(false); diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index de425e27d..a46cf7969 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -1190,40 +1190,20 @@ Zotero.Attachments = new function(){ } // Create orphaned-files directory if it doesn't exist - var orphaned = Zotero.getZoteroDirectory(); - orphaned.append('orphaned-files'); - if (!orphaned.exists()) { - orphaned.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); - } + var orphaned = OS.Path.join(Zotero.DataDirectory.dir, 'orphaned-files'); + yield Zotero.File.createDirectoryIfMissingAsync(orphaned); // Find unique filename for orphaned file - var orphanTarget = orphaned.clone(); - orphanTarget.append(dir.leafName); + var orphanTarget = OS.Path.join(orphaned, dir.leafName); var newName = null; - if (orphanTarget.exists()) { - try { - orphanTarget.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); - newName = orphanTarget.leafName; - } - catch (e) { - // DEBUG: Work around createUnique() brokenness on Windows - // as of Fx3.0.3 (https://bugzilla.mozilla.org/show_bug.cgi?id=452217) - // - // We just delete the conflicting file - if (Zotero.isWin && e.name == 'NS_ERROR_FILE_ACCESS_DENIED') { - orphanTarget.remove(true); - } - else { - throw (e); - } - } - if (newName) { - orphanTarget.remove(false); - } + if (yield OS.File.exists(orphanTarget)) { + let newFile = yield OS.File.openUnique(orphanTarget, { humanReadable: true }) + newName = OS.Path.basename(newFile.path); + newFile.file.close(); } // Move target to orphaned files directory - dir.moveTo(orphaned, newName); + dir.moveTo(Zotero.File.pathToFile(orphaned), newName); }); diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index aefbcb970..c98fd27f3 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -333,7 +333,7 @@ Zotero.Cite.getAbbreviation = new function() { } function loadAbbreviations() { - var file = Zotero.getZoteroDirectory(); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.dir); file.append("abbreviations.json"); var json, origin; diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 216de5fdc..4c28c37a6 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -874,7 +874,7 @@ Zotero.DBConnection.prototype.integrityCheck = Zotero.Promise.coroutine(function Zotero.DBConnection.prototype.checkException = function (e) { if (e.name && e.name == 'NS_ERROR_FILE_CORRUPTED') { // Write corrupt marker to data directory - var file = Zotero.getZoteroDatabase(this._dbName, 'is.corrupt'); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName, 'is.corrupt')); Zotero.File.putContents(file, ''); this._dbIsCorrupt = true; @@ -956,7 +956,9 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function }); try { - var corruptMarker = Zotero.getZoteroDatabase(this._dbName, 'is.corrupt'); + var corruptMarker = Zotero.File.pathToFile( + Zotero.DataDirectory.getDatabase(this._dbName, 'is.corrupt') + ); if (this.skipBackup || Zotero.skipLoading) { this._debug("Skipping backup of database '" + this._dbName + "'", 1); @@ -967,11 +969,11 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function return false; } - var file = Zotero.getZoteroDatabase(this._dbName); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName)); // For standard backup, make sure last backup is old enough to replace if (!suffix && !force) { - var backupFile = Zotero.getZoteroDatabase(this._dbName, 'bak'); + var backupFile = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName, 'bak')); if (yield OS.File.exists(backupFile.path)) { var currentDBTime = (yield OS.File.stat(file.path)).lastModificationDate; var lastBackupTime = (yield OS.File.stat(backupFile.path)).lastModificationDate; @@ -995,14 +997,14 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function // Copy via a temporary file so we don't run into disk space issues // after deleting the old backup file - var tmpFile = Zotero.getZoteroDatabase(this._dbName, 'tmp'); - if (yield OS.File.exists(tmpFile.path)) { + var tmpFile = Zotero.DataDirectory.getDatabase(this._dbName, 'tmp'); + if (yield OS.File.exists(tmpFile)) { try { - yield OS.File.remove(tmpFile.path); + yield OS.File.remove(tmpFile); } catch (e) { if (e.name == 'NS_ERROR_FILE_ACCESS_DENIED') { - alert("Cannot delete " + tmpFile.leafName); + alert("Cannot delete " + OS.Path.basename(tmpFile)); } throw (e); } @@ -1053,9 +1055,9 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function // Special backup if (!suffix && numBackups > 1) { // Remove oldest backup file - var targetFile = Zotero.getZoteroDatabase(this._dbName, (numBackups - 1) + '.bak') - if (yield OS.File.exists(targetFile.path)) { - yield OS.File.remove(targetFile.path); + var targetFile = Zotero.DataDirectory.getDatabase(this._dbName, (numBackups - 1) + '.bak'); + if (yield OS.File.exists(targetFile)) { + yield OS.File.remove(targetFile); } // Shift old versions up @@ -1063,33 +1065,34 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function var targetNum = i; var sourceNum = targetNum - 1; - var targetFile = Zotero.getZoteroDatabase( + var targetFile = Zotero.DataDirectory.getDatabase( this._dbName, targetNum + '.bak' ); - var sourceFile = Zotero.getZoteroDatabase( + var sourceFile = Zotero.DataDirectory.getDatabase( this._dbName, sourceNum ? sourceNum + '.bak' : 'bak' ); - if (!(yield OS.File.exists(sourceFile.path))) { + if (!(yield OS.File.exists(sourceFile))) { continue; } - Zotero.debug("Moving " + sourceFile.leafName + " to " + targetFile.leafName); - yield OS.File.move(sourceFile.path, targetFile.path); + Zotero.debug("Moving " + OS.Path.basename(sourceFile) + + " to " + OS.Path.basename(targetFile)); + yield OS.File.move(sourceFile, targetFile); } } - var backupFile = Zotero.getZoteroDatabase( + var backupFile = Zotero.DataDirectory.getDatabase( this._dbName, (suffix ? suffix + '.' : '') + 'bak' ); // Remove old backup file - if (yield OS.File.exists(backupFile.path)) { - OS.File.remove(backupFile.path); + if (yield OS.File.exists(backupFile)) { + OS.File.remove(backupFile); } - yield OS.File.move(tmpFile.path, backupFile.path); - Zotero.debug("Backed up to " + backupFile.leafName); + yield OS.File.move(tmpFile.path, backupFile); + Zotero.debug("Backed up to " + OS.Path.basename(backupFile)); return true; } @@ -1138,13 +1141,13 @@ Zotero.DBConnection.prototype._getConnectionAsync = Zotero.Promise.coroutine(fun var store = Components.classes["@mozilla.org/storage/service;1"]. getService(Components.interfaces.mozIStorageService); - var file = Zotero.getZoteroDatabase(this._dbName); - var backupFile = Zotero.getZoteroDatabase(this._dbName, 'bak'); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName)); + var backupFile = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName, 'bak')); var fileName = this._dbName + '.sqlite'; catchBlock: try { - var corruptMarker = Zotero.getZoteroDatabase(this._dbName, 'is.corrupt'); + var corruptMarker = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName, 'is.corrupt')); if (corruptMarker.exists()) { throw { name: 'NS_ERROR_FILE_CORRUPTED' @@ -1164,11 +1167,13 @@ Zotero.DBConnection.prototype._getConnectionAsync = Zotero.Promise.coroutine(fun // Save damaged filed this._debug('Saving damaged DB file with .damaged extension', 1); - var damagedFile = Zotero.getZoteroDatabase(this._dbName, 'damaged'); + var damagedFile = Zotero.File.pathToFile( + Zotero.DataDirectory.getDatabase(this._dbName, 'damaged') + ); Zotero.moveToUnique(file, damagedFile); // Create new main database - var file = Zotero.getZoteroDatabase(this._dbName); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName)); this._connection = store.openDatabase(file); if (corruptMarker.exists()) { @@ -1181,7 +1186,9 @@ Zotero.DBConnection.prototype._getConnectionAsync = Zotero.Promise.coroutine(fun // Save damaged file this._debug('Saving damaged DB file with .damaged extension', 1); - var damagedFile = Zotero.getZoteroDatabase(this._dbName, 'damaged'); + var damagedFile = Zotero.File.pathToFile( + Zotero.DataDirectory.getDatabase(this._dbName, 'damaged') + ); Zotero.moveToUnique(file, damagedFile); // Test the backup file @@ -1194,7 +1201,7 @@ Zotero.DBConnection.prototype._getConnectionAsync = Zotero.Promise.coroutine(fun // Can't open backup either catch (e) { // Create new main database - var file = Zotero.getZoteroDatabase(this._dbName); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.getDatabase(this._dbName)); this._connection = yield Zotero.Promise.resolve(this.Sqlite.openConnection({ path: file.path })); @@ -1221,10 +1228,9 @@ Zotero.DBConnection.prototype._getConnectionAsync = Zotero.Promise.coroutine(fun } // Open restored database - var file = Zotero.getZoteroDirectory(); - file.append(fileName); + var file = OS.Path.join(Zotero.DataDirectory.dir, fileName); this._connection = yield Zotero.Promise.resolve(this.Sqlite.openConnection({ - path: file.path + path: file })); this._debug('Database restored', 1); var msg = Zotero.getString('db.dbRestored', [ diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index 015fa1e12..f3441be44 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -261,7 +261,7 @@ Zotero.Fulltext = Zotero.FullText = new function(){ } } - var destDir = Zotero.getZoteroDirectory() + var destDir = Zotero.File.pathToFile(Zotero.DataDirectory.dir); // Move redirect script and executable into data dir if (tmpScriptFile) { yield OS.File.move( @@ -292,7 +292,7 @@ Zotero.Fulltext = Zotero.FullText = new function(){ */ this.registerPDFTool = Zotero.Promise.coroutine(function* (tool) { var errMsg = false; - var exec = Zotero.getZoteroDirectory(); + var exec = Zotero.File.pathToFile(Zotero.DataDirectory.dir); switch (tool) { case 'converter': @@ -342,7 +342,7 @@ Zotero.Fulltext = Zotero.FullText = new function(){ case 'converter': // TEMP: disabled if (false && Zotero.isWin) { - var script = Zotero.getZoteroDirectory(); + var script = Zotero.File.pathToFile(Zotero.DataDirectory.dir); script.append('pdftotext.' + _getScriptExtension()) if (script.exists()) { Zotero.debug(script.leafName + " registered"); @@ -355,7 +355,7 @@ Zotero.Fulltext = Zotero.FullText = new function(){ // Modified 3.02 version doesn't use redirection script if (version.startsWith('3.02')) break; - var script = Zotero.getZoteroDirectory(); + var script = Zotero.File.pathToFile(Zotero.DataDirectory.dir); // TEMP: disabled on Win if (!Zotero.isWin) { script.append('pdfinfo.' + _getScriptExtension()) @@ -396,7 +396,6 @@ Zotero.Fulltext = Zotero.FullText = new function(){ this.uninstallPDFTools = Zotero.Promise.coroutine(function* () { Zotero.debug("Uninstalling PDF tools"); - var dataDir = Zotero.getZoteroDirectory().path; if (_pdfConverter) { yield Zotero.File.removeIfExists(_pdfConverter.path); yield Zotero.File.removeIfExists(_pdfConverter.path + ".version"); diff --git a/chrome/content/zotero/xpcom/ipc.js b/chrome/content/zotero/xpcom/ipc.js index 0e6c117bc..fedb07206 100755 --- a/chrome/content/zotero/xpcom/ipc.js +++ b/chrome/content/zotero/xpcom/ipc.js @@ -66,7 +66,7 @@ Zotero.IPC = new function() { // Standalone sends this to the Firefox extension to tell the Firefox extension to // release its lock on the Zotero database if(!Zotero.isConnector && (msg.length === 11 || - msg.substr(12) === Zotero.getZoteroDatabase().persistentDescriptor)) { + msg.substr(12) === Zotero.DataDirectory.getDatabase())) { switchConnectorMode(true); } } else if(msg === "lockReleased") { @@ -284,7 +284,7 @@ Zotero.IPC = new function() { * Get directory containing Zotero pipes */ function _getPipeDirectory() { - var dir = Zotero.getZoteroDirectory(); + var dir = Zotero.File.pathToFile(Zotero.DataDirectory.dir); dir.append("pipes"); return dir; } diff --git a/chrome/content/zotero/xpcom/locateManager.js b/chrome/content/zotero/xpcom/locateManager.js index 4fdecda86..dc3c09f00 100644 --- a/chrome/content/zotero/xpcom/locateManager.js +++ b/chrome/content/zotero/xpcom/locateManager.js @@ -166,7 +166,7 @@ Zotero.LocateManager = new function() { * Gets the dir containing the JSON file and engine icons */ function _getLocateDirectory() { - var locateDir = Zotero.getZoteroDirectory(); + var locateDir = Zotero.File.pathToFile(Zotero.DataDirectory.dir); locateDir.append(LOCATE_DIR_NAME); return locateDir; } diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index e1d6706c1..5d59871d5 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -151,7 +151,7 @@ Zotero.Schema = new function(){ if (updated) { // Upgrade seems to have been a success -- delete any previous backups var maxPrevious = userdata - 1; - var file = Zotero.getZoteroDirectory(); + var file = Zotero.File.pathToFile(Zotero.DataDirectory.dir); var toDelete = []; try { var files = file.directoryEntries; diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index 2dace66da..fefbd1d9d 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -131,7 +131,7 @@ Zotero.Sync.Data.Local = { var accept = false; if (io.accept) { - var resetDataDirFile = OS.Path.join(Zotero.getZoteroDirectory().path, 'reset-data-directory'); + var resetDataDirFile = OS.Path.join(Zotero.DataDirectory.dir, 'reset-data-directory'); yield Zotero.File.putContentsAsync(resetDataDirFile, ''); Zotero.Utilities.Internal.quitZotero(true); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 143ee040e..15dc3e8d8 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -470,7 +470,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); // TODO: Back up database - var dbfile = Zotero.getZoteroDatabase().path; + var dbfile = Zotero.DataDirectory.getDatabase(); yield OS.File.remove(dbfile, {ignoreAbsent: true}); if (Zotero.restoreFromServer) { @@ -755,20 +755,20 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); // Test read access yield Zotero.DB.test(); - var dbfile = Zotero.getZoteroDatabase(); + let dbfile = Zotero.DataDirectory.getDatabase(); // Tell any other Zotero instances to release their lock, // in case we lost the lock on the database (how?) and it's // now open in two places at once - Zotero.IPC.broadcast("releaseLock "+dbfile.persistentDescriptor); + Zotero.IPC.broadcast("releaseLock " + dbfile); // Test write access on Zotero data directory - if (!dbfile.parent.isWritable()) { - var msg = 'Cannot write to ' + dbfile.parent.path + '/'; + if (!Zotero.File.pathToFile(OS.Path.dirname(dbfile)).isWritable()) { + var msg = 'Cannot write to ' + OS.Path.dirname(dbfile) + '/'; } // Test write access on Zotero database - else if (!dbfile.isWritable()) { - var msg = 'Cannot write to ' + dbfile.path; + else if (!Zotero.File.pathToFile(dbfile).isWritable()) { + var msg = 'Cannot write to ' + dbfile; } else { var msg = false; @@ -897,9 +897,8 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); function getStorageDirectory(){ - var file = Zotero.getZoteroDirectory(); - - file.append('storage'); + var file = OS.Path.join(Zotero.DataDirectory.dir, 'storage'); + file = Zotero.File.pathToFile(file); Zotero.File.createDirectoryIfMissing(file); return file; } @@ -915,7 +914,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); * @return {nsIFile} */ this.getTempDirectory = function () { - var tmp = this.getZoteroDirectory(); + var tmp = Zotero.File.pathToFile(Zotero.DataDirectory.dir); tmp.append('tmp'); Zotero.File.createDirectoryIfMissing(tmp); return tmp; @@ -923,7 +922,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); this.removeTempDirectory = function () { - var tmp = this.getZoteroDirectory(); + var tmp = Zotero.File.pathToFile(Zotero.DataDirectory.dir); tmp.append('tmp'); if (tmp.exists()) { try { @@ -935,7 +934,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); this.getStylesDirectory = function () { - var dir = this.getZoteroDirectory(); + var dir = Zotero.File.pathToFile(Zotero.DataDirectory.dir); dir.append('styles'); Zotero.File.createDirectoryIfMissing(dir); return dir; @@ -943,7 +942,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); this.getTranslatorsDirectory = function () { - var dir = this.getZoteroDirectory(); + var dir = Zotero.File.pathToFile(Zotero.DataDirectory.dir); dir.append('translators'); Zotero.File.createDirectoryIfMissing(dir); return dir; diff --git a/test/content/support.js b/test/content/support.js index ce2a75ddd..2bb825aec 100644 --- a/test/content/support.js +++ b/test/content/support.js @@ -516,13 +516,16 @@ function resetDB(options = {}) { if (options.thisArg) { options.thisArg.timeout(60000); } - var db = Zotero.getZoteroDatabase(); - return Zotero.reinit(function() { - db.remove(false); - _defaultGroup = null; - }, false, options).then(function() { - return Zotero.Schema.schemaUpdatePromise; - }); + var db = Zotero.DataDirectory.getDatabase(); + return Zotero.reinit( + Zotero.Promise.coroutine(function* () { + yield OS.File.remove(db); + _defaultGroup = null; + }), + false, + options + ) + .then(() => Zotero.Schema.schemaUpdatePromise); } /** diff --git a/test/tests/fulltextTest.js b/test/tests/fulltextTest.js index 32bf19bcc..23480f343 100644 --- a/test/tests/fulltextTest.js +++ b/test/tests/fulltextTest.js @@ -78,7 +78,7 @@ describe("Zotero.Fulltext", function () { yield Zotero.Fulltext.uninstallPDFTools(); assert.isFalse(Zotero.Fulltext.pdfInfoIsRegistered()); - var dataDir = Zotero.getZoteroDirectory().path; + var dataDir = Zotero.DataDirectory.dir; var execFileName = Zotero.Fulltext.pdfInfoFileName; var execPath = OS.Path.join(dataDir, execFileName); var versionFileName = execFileName + '.version'; diff --git a/test/tests/storageLocalTest.js b/test/tests/storageLocalTest.js index cb696dda8..6472ea81f 100644 --- a/test/tests/storageLocalTest.js +++ b/test/tests/storageLocalTest.js @@ -157,7 +157,7 @@ describe("Zotero.Sync.Storage.Local", function () { yield OS.File.makeDir( OS.Path.join(dir, 'subdir'), { - from: Zotero.getZoteroDirectory().path, + from: Zotero.DataDirectory.dir, unixMode: 0o755 } ); diff --git a/test/tests/syncLocalTest.js b/test/tests/syncLocalTest.js index e2e9aa91e..247072927 100644 --- a/test/tests/syncLocalTest.js +++ b/test/tests/syncLocalTest.js @@ -22,7 +22,7 @@ describe("Zotero.Sync.Data.Local", function() { describe("#checkUser()", function () { - var resetDataDirFile = OS.Path.join(Zotero.getZoteroDirectory().path, 'reset-data-directory'); + var resetDataDirFile = OS.Path.join(Zotero.DataDirectory.dir, 'reset-data-directory'); before(function() { sinon.stub(Zotero.Utilities.Internal, 'quitZotero');