MCPcopy
hub / github.com/anomalyco/opencode / getFilename

Function getFilename

packages/core/src/util/path.ts:1–6  ·  view source on GitHub ↗
(path: string | undefined)

Source from the content-addressed store, hash-verified

1export function getFilename(path: string | undefined) {
2 if (!path) return ""
3 const trimmed = path.replace(/[/\\]+$/, "")
4 const parts = trimmed.split(/[/\\]/)
5 return parts[parts.length - 1] ?? ""
6}
7
8export function getDirectory(path: string | undefined) {
9 if (!path) return ""

Callers 15

labelFunction · 0.90
DialogSelectFileFunction · 0.90
DialogEditProjectFunction · 0.90
createDirectorySearchFunction · 0.90
labelFunction · 0.90
PromptWorkspaceSelectorFunction · 0.90
toRowFunction · 0.90
DialogSelectDirectoryFunction · 0.90
FileVisualFunction · 0.90
labelFunction · 0.90
NewSessionViewFunction · 0.90
SessionHeaderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected