@@ -56,12 +56,6 @@ const binName = isWindows ? "rg.exe" : "rg"
5656// bin/<platform>-<arch>/ rather than directly in bin/.
5757const ripgrepUniversalBinDir = `bin/${ process . platform } -${ process . arch } `
5858
59- // @vscode /ripgrep >=1.18 ships the binary in a platform-specific optional
60- // package (e.g. @vscode/ripgrep-win32-x64). Matches the wrapper's own arch
61- // selection: process.env.npm_config_arch || process.arch.
62- const platformPkgArch = process . env . npm_config_arch || process . arch
63- const ripgrepPlatformPkg = `@vscode/ripgrep-${ process . platform } -${ platformPkgArch } `
64-
6559interface SearchFileResult {
6660 file : string
6761 searchResults : SearchResult [ ]
@@ -96,6 +90,9 @@ export function truncateLine(line: string, maxLength: number = MAX_LINE_LENGTH):
9690 * resolution) and the diagnostic command (existence report for all paths).
9791 */
9892export function ripgrepCandidatePaths ( vscodeAppRoot : string ) : readonly string [ ] {
93+ // Read at call time so process.env.npm_config_arch overrides take effect,
94+ // matching @vscode /ripgrep's own arch selection logic.
95+ const platformPkg = `@vscode/ripgrep-${ process . platform } -${ process . env . npm_config_arch || process . arch } `
9996 return [
10097 path . join ( vscodeAppRoot , "node_modules/@vscode/ripgrep/bin/" , binName ) ,
10198 path . join ( vscodeAppRoot , "node_modules/vscode-ripgrep/bin" , binName ) ,
@@ -108,8 +105,8 @@ export function ripgrepCandidatePaths(vscodeAppRoot: string): readonly string[]
108105 binName ,
109106 ) ,
110107 // @vscode /ripgrep >=1.18 (VS Code 1.130+): binary lives in a platform-specific optional package.
111- path . join ( vscodeAppRoot , `node_modules/${ ripgrepPlatformPkg } /bin` , binName ) ,
112- path . join ( vscodeAppRoot , `node_modules.asar.unpacked/${ ripgrepPlatformPkg } /bin` , binName ) ,
108+ path . join ( vscodeAppRoot , `node_modules/${ platformPkg } /bin` , binName ) ,
109+ path . join ( vscodeAppRoot , `node_modules.asar.unpacked/${ platformPkg } /bin` , binName ) ,
113110 ]
114111}
115112
0 commit comments