Skip to content

Commit

Permalink
fix: 优化转换器下载,修改文件权限导致的下载失败
Browse files Browse the repository at this point in the history
  • Loading branch information
l0o0 committed Dec 26, 2023
1 parent a47e0e7 commit 43ce213
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/modules/preferenceScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@ async function updateTranslatorImg(filename: string): Promise<void> {
}

async function downloadTranslator(filename: string): Promise<void> {
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}`;
Expand All @@ -218,12 +213,7 @@ async function downloadTranslator(filename: string): Promise<void> {
),
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(
Expand Down

0 comments on commit 43ce213

Please sign in to comment.