improvement(chat): 优化导出筛选与目录选择体验

This commit is contained in:
2977094657
2026-02-09 00:15:47 +08:00
parent 62f396e55b
commit a20df89ee7
7 changed files with 1203 additions and 355 deletions

View File

@@ -611,6 +611,25 @@ function registerWindowIpc() {
return getCloseBehavior();
}
});
ipcMain.handle("dialog:chooseDirectory", async (_event, options) => {
try {
const result = await dialog.showOpenDialog({
title: String(options?.title || "选择文件夹"),
properties: ["openDirectory", "createDirectory"],
});
return {
canceled: !!result?.canceled,
filePaths: Array.isArray(result?.filePaths) ? result.filePaths : [],
};
} catch (err) {
logMain(`[main] dialog:chooseDirectory failed: ${err?.message || err}`);
return {
canceled: true,
filePaths: [],
};
}
});
}
async function main() {

View File

@@ -11,4 +11,6 @@ contextBridge.exposeInMainWorld("wechatDesktop", {
getCloseBehavior: () => ipcRenderer.invoke("app:getCloseBehavior"),
setCloseBehavior: (behavior) => ipcRenderer.invoke("app:setCloseBehavior", String(behavior || "")),
chooseDirectory: (options = {}) => ipcRenderer.invoke("dialog:chooseDirectory", options),
});