fix: S1 安全冲刺——切库清空标签页+冲刷(FR-V6)、重命名/移动同步标签页路径(FR-T7)、默认库路径设置页(FR-V5);vaultBrowse IPC+pickDirectory;tab-store closeAll/renamePath;store resetEditor/syncCurrentPath;safety E2E 2 项
This commit is contained in:
@@ -15,6 +15,7 @@ export function registerIpc(vault: VaultService) {
|
||||
ipcMain.handle(IPC.vaultSwitch, async (_e, p: { root: string }) => vault.switch(p.root));
|
||||
ipcMain.handle(IPC.vaultSetDefault, async (_e, p: { root: string }) => { await vault.setDefaultRoot(p.root); });
|
||||
ipcMain.handle(IPC.vaultPick, async () => vault.pickAndSwitch());
|
||||
ipcMain.handle(IPC.vaultBrowse, async () => vault.pickDirectory());
|
||||
|
||||
ipcMain.handle(IPC.treeList, async () => fs2().listTree());
|
||||
ipcMain.handle(IPC.treeRefresh, async () => fs2().listTree());
|
||||
|
||||
@@ -39,6 +39,13 @@ export class VaultService {
|
||||
return this.switch(result.filePaths[0]);
|
||||
}
|
||||
|
||||
// 仅浏览选择目录路径,不切换(FR-V5 设置页浏览按钮)
|
||||
async pickDirectory(): Promise<string | null> {
|
||||
const result = await dialog.showOpenDialog({ properties: ['openDirectory'] });
|
||||
if (result.canceled || result.filePaths.length === 0) return null;
|
||||
return result.filePaths[0];
|
||||
}
|
||||
|
||||
async switch(root: string): Promise<VaultMeta> {
|
||||
// 校验是存在的目录
|
||||
const stat = await fs.stat(root).catch(() => null);
|
||||
|
||||
Reference in New Issue
Block a user