Misc nodejs environment compatibility
This commit is contained in:
parent
b62b1968cf
commit
c3bdf72f35
3 changed files with 11 additions and 8 deletions
|
@ -107,11 +107,11 @@ Zotero.File = new function(){
|
|||
}
|
||||
|
||||
var dir = OS.Path.dirname(file);
|
||||
while (dir && !await OS.File.exists(dir)) {
|
||||
while (dir && dir != '/' && !await OS.File.exists(dir)) {
|
||||
dir = OS.Path.dirname(dir);
|
||||
}
|
||||
|
||||
return dir || false;
|
||||
return (dir && dir != '/') ? dir : false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -215,4 +215,7 @@ Zotero.Translator.replaceDeprecatedStatements = function(code) {
|
|||
|
||||
Zotero.Translator.RUN_MODE_IN_BROWSER = 1;
|
||||
Zotero.Translator.RUN_MODE_ZOTERO_STANDALONE = 2;
|
||||
Zotero.Translator.RUN_MODE_ZOTERO_SERVER = 4;
|
||||
Zotero.Translator.RUN_MODE_ZOTERO_SERVER = 4;
|
||||
Zotero.Translator.TRANSLATOR_TYPES = TRANSLATOR_TYPES;
|
||||
Zotero.Translator.TRANSLATOR_OPTIONAL_PROPERTIES = TRANSLATOR_OPTIONAL_PROPERTIES;
|
||||
Zotero.Translator.TRANSLATOR_REQUIRED_PROPERTIES = TRANSLATOR_REQUIRED_PROPERTIES;
|
||||
|
|
|
@ -181,10 +181,10 @@ Zotero.Translators = new function() {
|
|||
|
||||
// add to cache
|
||||
_translators[translator.translatorID] = translator;
|
||||
for (let type in TRANSLATOR_TYPES) {
|
||||
if (translator.translatorType & TRANSLATOR_TYPES[type]) {
|
||||
for (let type in Zotero.Translator.TRANSLATOR_TYPES) {
|
||||
if (translator.translatorType & Zotero.Translator.TRANSLATOR_TYPES[type]) {
|
||||
_cache[type].push(translator);
|
||||
if ((translator.translatorType & TRANSLATOR_TYPES.web) && translator.targetAll) {
|
||||
if ((translator.translatorType & Zotero.Translator.TRANSLATOR_TYPES.web) && translator.targetAll) {
|
||||
_cache.webWithTargetAll.push(translator);
|
||||
}
|
||||
}
|
||||
|
@ -193,8 +193,8 @@ Zotero.Translators = new function() {
|
|||
if (!dbCacheEntry) {
|
||||
yield Zotero.Translators.cacheInDB(
|
||||
fileName,
|
||||
translator.serialize(TRANSLATOR_REQUIRED_PROPERTIES.
|
||||
concat(TRANSLATOR_OPTIONAL_PROPERTIES)),
|
||||
translator.serialize(Zotero.Translator.TRANSLATOR_REQUIRED_PROPERTIES.
|
||||
concat(Zotero.Translator.TRANSLATOR_OPTIONAL_PROPERTIES)),
|
||||
lastModifiedTime
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue