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

Function normalizeArchiveExtension

src/daemon/artifact-materialization.ts:195–219  ·  view source on GitHub ↗
(
  archivePath: string,
  desiredExtension: string,
  acceptedExtensions: string[] = [desiredExtension],
)

Source from the content-addressed store, hash-verified

193}
194
195function normalizeArchiveExtension(
196 archivePath: string,
197 desiredExtension: string,
198 acceptedExtensions: string[] = [desiredExtension],
199): string {
200 const loweredPath = archivePath.toLowerCase();
201 if (acceptedExtensions.some((extension) => loweredPath.endsWith(extension))) {
202 return archivePath;
203 }
204 const normalizedPath = `${archivePath}${desiredExtension}`;
205 try {
206 fs.renameSync(archivePath, normalizedPath);
207 return normalizedPath;
208 } catch (error) {
209 throw new AppError(
210 'COMMAND_FAILED',
211 `Failed to normalize artifact path to ${desiredExtension}`,
212 {
213 from: archivePath,
214 to: normalizedPath,
215 },
216 error instanceof Error ? error : undefined,
217 );
218 }
219}
220
221function isTarLikePath(filePath: string): boolean {
222 const lowered = filePath.toLowerCase();

Callers 2

resolveAndroidArtifactFunction · 0.85
resolveIosArtifactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…