MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / existingPathVariant

Function existingPathVariant

desktop/runtime/attachment-file-tools.ts:42–59  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

40}
41
42async function existingPathVariant(filePath: string) {
43 const candidates = [
44 filePath,
45 filePath.replace(/ (AM|PM)\./gi, `${narrowNoBreakSpace}$1.`),
46 filePath.normalize('NFD'),
47 filePath.replace(/'/g, '’'),
48 filePath.normalize('NFD').replace(/'/g, '’'),
49 ]
50 for (const candidate of candidates) {
51 try {
52 await stat(candidate)
53 return candidate
54 } catch {
55 // Try the next Pi-compatible path variant.
56 }
57 }
58 return filePath
59}
60
61function resolveToolPath(filePath: string, cwd: string) {
62 const withoutAt = filePath.startsWith('@') ? filePath.slice(1) : filePath

Callers 2

isGrantedPathFunction · 0.85
isGrantedDirectoryPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected