From 43ce213e36da0deba677e6b6348f2c488f66d873 Mon Sep 17 00:00:00 2001 From: Linxzh Date: Tue, 26 Dec 2023 16:59:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E5=99=A8=E4=B8=8B=E8=BD=BD=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=9D=83=E9=99=90=E5=AF=BC=E8=87=B4=E7=9A=84=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/preferenceScript.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/modules/preferenceScript.ts b/src/modules/preferenceScript.ts index 503da7b..1db0eaa 100644 --- a/src/modules/preferenceScript.ts +++ b/src/modules/preferenceScript.ts @@ -194,11 +194,6 @@ async function updateTranslatorImg(filename: string): Promise { } async function downloadTranslator(filename: string): Promise { - const cacheFile = ztoolkit.getGlobal("Zotero").getTempDirectory(); - cacheFile.append(filename); - if (cacheFile.exists()) { - cacheFile.remove(false); - } // var url = `https://gitee.com/l0o0/translators_CN/raw/master/translators/${label}`; // var url = `https://gitcode.net/goonback/translators_CN/-/raw/master/translators/${label}`; // let url = `https://oss.wwang.de/translators_CN/${label}`; @@ -218,12 +213,7 @@ async function downloadTranslator(filename: string): Promise { ), filename ); - const desPathFile = ztoolkit - .getGlobal("Zotero") - .File.pathToFile(desPath) as nsIFile; - await ztoolkit - .getGlobal("Zotero") - .File.putContentsAsync(desPathFile, contents); + await IOUtils.writeUTF8(desPath, contents); await updateTranslatorImg(filename); ztoolkit.log(`${filename} 下载成功`); showPop(