MCPcopy
hub / github.com/codeaashu/claude-code / getGlobBaseDirectory

Function getGlobBaseDirectory

src/tools/PowerShellTool/pathValidation.ts:1266–1278  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

1264}
1265
1266function getGlobBaseDirectory(filePath: string): string {
1267 const globMatch = filePath.match(GLOB_PATTERN_REGEX)
1268 if (!globMatch || globMatch.index === undefined) {
1269 return filePath
1270 }
1271 const beforeGlob = filePath.substring(0, globMatch.index)
1272 const lastSepIndex = Math.max(
1273 beforeGlob.lastIndexOf('/'),
1274 beforeGlob.lastIndexOf('\\'),
1275 )
1276 if (lastSepIndex === -1) return '.'
1277 return beforeGlob.substring(0, lastSepIndex + 1) || '/'
1278}
1279
1280/**
1281 * Element types that are safe to extract as literal path strings.

Callers 1

validatePathFunction · 0.70

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected