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,
This commit is contained in:
parent
4c0abb6816
commit
5a6f1eef63
16 changed files with 88 additions and 101 deletions
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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', [
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue