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

Function getDirectory

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

Source from the content-addressed store, hash-verified

6}
7
8export function getDirectory(path: string | undefined) {
9 if (!path) return ""
10 const trimmed = path.replace(/[/\\]+$/, "")
11 const parts = trimmed.split(/[/\\]/)
12 return parts.slice(0, parts.length - 1).join("/") + "/"
13}
14
15export function getFileExtension(path: string | undefined) {
16 if (!path) return ""

Callers 12

DialogSelectFileFunction · 0.90
DialogSelectDirectoryFunction · 0.90
NewSessionViewFunction · 0.90
PromptContextItemsFunction · 0.90
PromptPopoverFunction · 0.90
TimelineDiffSummaryRowFunction · 0.90
SessionTurnFunction · 0.90
LineCommentEditorFunction · 0.90
SessionReviewFunction · 0.90
contextToolTriggerFunction · 0.90
ToolFileAccordionFunction · 0.90
renderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected