功能: 右键支持在访达中打开与添加本地文件到版本控制(FE-025),中间区域空白处提供当前目录菜单
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -85,6 +85,28 @@ export async function pathsExist(paths: string[]): Promise<Record<string, boolea
|
||||
return bridge.pathsExist(paths)
|
||||
}
|
||||
|
||||
/**
|
||||
* 在访达中打开本地路径(目录直接进入,文件定位选中),非 Electron 环境返回 false。
|
||||
*/
|
||||
export async function revealPath(targetPath: string, isFolder: boolean): Promise<boolean> {
|
||||
const bridge = getBridge()
|
||||
if (!bridge) {
|
||||
return false
|
||||
}
|
||||
return bridge.revealPath(targetPath, isFolder)
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开系统文件选择器(多选),非 Electron 环境返回 null。
|
||||
*/
|
||||
export async function selectFiles(defaultPath?: string): Promise<string[] | null> {
|
||||
const bridge = getBridge()
|
||||
if (!bridge) {
|
||||
return null
|
||||
}
|
||||
return bridge.selectFiles(defaultPath)
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造非 Electron 环境下的占位服务状态。
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,8 @@ export {
|
||||
getToken,
|
||||
isElectron,
|
||||
pathsExist,
|
||||
revealPath,
|
||||
selectDirectory,
|
||||
selectFiles,
|
||||
startService,
|
||||
} from "./bridge"
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface MactfsBridge {
|
||||
startService(): Promise<ServiceStatus>
|
||||
selectDirectory(): Promise<string | null>
|
||||
pathsExist(paths: string[]): Promise<Record<string, boolean>>
|
||||
revealPath(targetPath: string, isFolder: boolean): Promise<boolean>
|
||||
selectFiles(defaultPath?: string): Promise<string[] | null>
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
||||
Reference in New Issue
Block a user