Skip to content

Commit 9c13685

Browse files
committed
Remove hardcoded extension from dlxBinary auto-generated names
Don't assume .cmd extension on Windows - binaries can have various extensions (.exe, .cmd, .bat, .ps1). When name is not provided, generate binary-{platform}-{arch} without extension. Callers should provide explicit name with extension if needed.
1 parent 541bfc9 commit 9c13685

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

registry/src/lib/dlx-binary.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import os from 'node:os'
66
import path from 'node:path'
77

88
import DLX_BINARY_CACHE_TTL from './constants/DLX_BINARY_CACHE_TTL'
9-
import EXT_CMD from './constants/EXT_CMD'
109
import WIN32 from './constants/WIN32'
1110
import { isDir, readJson, remove } from './fs'
1211
import { httpRequest } from './http-request'
@@ -250,9 +249,8 @@ export async function dlxBinary(
250249
const cacheDir = getDlxCachePath()
251250
const cacheKey = generateCacheKey(url)
252251
const cacheEntryDir = path.join(cacheDir, cacheKey)
253-
// Use current platform for extension since we'll execute on current platform.
254-
const ext = WIN32 ? EXT_CMD : ''
255-
const binaryName = name || `binary-${targetPlatform}-${arch}${ext}`
252+
const platformKey = `${targetPlatform}-${arch}`
253+
const binaryName = name || `binary-${platformKey}`
256254
const binaryPath = normalizePath(path.join(cacheEntryDir, binaryName))
257255

258256
let downloaded = false

0 commit comments

Comments
 (0)