MCPcopy Create free account
hub / github.com/experdot/pointer / getFolderPath

Function getFolderPath

src/renderer/src/utils/globalSearchUtils.ts:22–39  ·  view source on GitHub ↗

* 获取页面的文件夹路径

(
  parentFolderId: string | undefined,
  folders: PageFolder[]
)

Source from the content-addressed store, hash-verified

20 * 获取页面的文件夹路径
21 */
22function getFolderPath(
23 parentFolderId: string | undefined,
24 folders: PageFolder[]
25): string | undefined {
26 if (!parentFolderId) return undefined
27
28 const pathParts: string[] = []
29 let currentId: string | undefined = parentFolderId
30
31 while (currentId) {
32 const folder = folders.find((f) => f.id === currentId)
33 if (!folder) break
34 pathParts.unshift(folder.name)
35 currentId = folder.parentFolderId
36 }
37
38 return pathParts.length > 0 ? pathParts.join(' / ') : undefined
39}
40
41/**
42 * 检查页面是否在指定的文件夹中(包括子文件夹)

Callers 1

performGlobalSearchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected