| 770 | } |
| 771 | |
| 772 | function lookup(root: TreeNode, path: string): TreeNode | undefined { |
| 773 | if (path === '/') return root; |
| 774 | const parts = path.split('/').filter(Boolean); |
| 775 | let current: TreeNode | undefined = root; |
| 776 | for (const part of parts) { |
| 777 | if (!current?.children?.[part]) return undefined; |
| 778 | current = current.children[part]; |
| 779 | } |
| 780 | return current; |
| 781 | } |
| 782 | |
| 783 | // Fake SFTP that exposes a tree and implements the handful of callbacks |
| 784 | // SSHKaos actually calls. Anything not needed is left unimplemented. |