| 79 | |
| 80 | const cache = new Map<string, string>() |
| 81 | const resolve = (id: string): string => { |
| 82 | const cached = cache.get(id) |
| 83 | if (cached !== undefined) return cached |
| 84 | const folder = folderMap.get(id) |
| 85 | if (!folder) return '' |
| 86 | const parentPath = folder.parentId ? resolve(folder.parentId) : '' |
| 87 | const path = parentPath |
| 88 | ? `${parentPath}/${encodeVfsSegment(folder.name)}` |
| 89 | : encodeVfsSegment(folder.name) |
| 90 | cache.set(id, path) |
| 91 | return path |
| 92 | } |
| 93 | |
| 94 | for (const id of folderMap.keys()) resolve(id) |
| 95 | return cache |