Skip to content

Commit

Permalink
🐛 修复导出路径异常
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Jul 9, 2024
1 parent 7baa805 commit 5e32cce
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/utils/TGClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,19 +909,16 @@ class TGClient {
var buffer = new Uint8Array(atob('${image}'.split(',')[1]).split('').map(function(item) {
return item.charCodeAt(0);
}));
var _t = window.__TAURI__;
var savePath = await _t.path.downloadDir() + Date.now() + '.png';
var save = await _t.dialog.save({
title: '保存图片',
filters: [{ name: '图片', extensions: ['png'] }],
defaultPath: savePath,
var _path = window.__TAURI__.path;
var saveDefault = await _path.downloadDir() + _path.sep() + Date.now() + ".png";
var savePath = await window.__TAURI_PLUGIN_DIALOG__.save({
title: "保存图片",
filters: [{ name: "图片", extensions: ["png"] }],
defaultPath: saveDefault,
});
if (save) {
await _t.fs.writeBinaryFile({
contents: buffer,
path: save,
});
alert('保存成功');
if (savePath !== null) {
await window.__TAURI_PLUGIN_FS__.writeFile(savePath, buffer);
alert("保存成功");
}
mhyWebBridge('${arg.callback}', {});
})();`;
Expand Down

0 comments on commit 5e32cce

Please sign in to comment.