MCPcopy Create free account
hub / github.com/codeaashu/claude-code / getAlternateScreenshotPath

Function getAlternateScreenshotPath

src/tools/FileReadTool/FileReadTool.ts:147–159  ·  view source on GitHub ↗

* For macOS screenshot paths with AM/PM, the space before AM/PM may be a * regular space or a thin space depending on the macOS version. Returns * the alternate path to try if the original doesn't exist, or undefined.

(filePath: string)

Source from the content-addressed store, hash-verified

145 * the alternate path to try if the original doesn't exist, or undefined.
146 */
147function getAlternateScreenshotPath(filePath: string): string | undefined {
148 const filename = path.basename(filePath)
149 const amPmPattern = /^(.+)([ \u202F])(AM|PM)(\.png)$/
150 const match = filename.match(amPmPattern)
151 if (!match) return undefined
152
153 const currentSpace = match[2]
154 const alternateSpace = currentSpace === ' ' ? THIN_SPACE : ' '
155 return filePath.replace(
156 `${currentSpace}${match[3]}${match[4]}`,
157 `${alternateSpace}${match[3]}${match[4]}`,
158 )
159}
160
161// File read listeners - allows other services to be notified when files are read
162type FileReadListener = (filePath: string, content: string) => void

Callers 1

callFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected