MCPcopy Create free account
hub / github.com/callstack/agent-device / resolveScriptPath

Function resolveScriptPath

src/recording/overlay.ts:13–36  ·  view source on GitHub ↗
(scriptName: string)

Source from the content-addressed store, hash-verified

11} from '../core/recording-export-quality.ts';
12
13function resolveScriptPath(scriptName: string): string {
14 const moduleDir = path.dirname(fileURLToPath(import.meta.url));
15 const scriptCandidates = [
16 fileURLToPath(new URL(`./${scriptName}`, import.meta.url)),
17 path.resolve(moduleDir, `../../apple-runner/AgentDeviceRunner/RecordingScripts/${scriptName}`),
18 path.resolve(
19 moduleDir,
20 `../../../apple-runner/AgentDeviceRunner/RecordingScripts/${scriptName}`,
21 ),
22 path.resolve(process.cwd(), `apple-runner/AgentDeviceRunner/RecordingScripts/${scriptName}`),
23 ];
24
25 for (const candidate of scriptCandidates) {
26 if (fs.existsSync(candidate)) {
27 return candidate;
28 }
29 }
30
31 throw new AppError('COMMAND_FAILED', `Missing recording helper script: ${scriptName}`, {
32 hint: 'Ensure apple-runner/AgentDeviceRunner/RecordingScripts is present in this checkout or bundled with the package.',
33 scriptName,
34 searchedPaths: scriptCandidates,
35 });
36}
37
38let overlayScriptPath: string | undefined;
39let trimScriptPath: string | undefined;

Callers 3

getOverlayScriptPathFunction · 0.70
getTrimScriptPathFunction · 0.70
getResizeScriptPathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…