MCPcopy
hub / github.com/upstash/context7 / resolveReadPath

Function resolveReadPath

packages/cli/src/utils/storage-paths.ts:109–120  ·  view source on GitHub ↗
(
  fileName: string,
  targetPath: string,
  mode?: number
)

Source from the content-addressed store, hash-verified

107}
108
109export async function resolveReadPath(
110 fileName: string,
111 targetPath: string,
112 mode?: number
113): Promise<string> {
114 await migrateLegacyFile(fileName, targetPath, mode);
115 if (await exists(targetPath)) {
116 return targetPath;
117 }
118 const legacyPath = getLegacyFilePath(fileName);
119 return (await exists(legacyPath)) ? legacyPath : targetPath;
120}
121
122async function exists(filePath: string): Promise<boolean> {
123 try {

Callers 1

readStateFilePathFunction · 0.85

Calls 3

migrateLegacyFileFunction · 0.85
getLegacyFilePathFunction · 0.85
existsFunction · 0.70

Tested by

no test coverage detected