MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / findBrowserBinary

Function findBrowserBinary

scripts/run_start.mjs:147–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145const runBuildPath = path.join(import.meta.dirname, 'run_build.mjs');
146
147async function findBrowserBinary() {
148 if (browser === 'chromium') {
149 const result = isInChromiumDirectory();
150 if (!result.isInChromium) {
151 throw new Error('Not in Chromium checkout');
152 }
153 const args = await gnArgsForTarget(target);
154 const paths = {
155 linux: path.join('chrome'),
156 darwin:
157 args.get('is_chrome_branded') === 'true'
158 ? path.join('Chromium.app', 'Contents', 'MacOS', 'Chromium')
159 : path.join(
160 'Google Chrome.app',
161 'Contents',
162 'MacOS',
163 'Google Chrome',
164 ),
165 win32: path.join('chrome.exe'),
166 };
167 const binary = path.join(
168 result.chromiumDirectory,
169 'out',
170 target,
171 paths[os.platform()],
172 );
173
174 if (verbose) {
175 console.debug('Located Chrome build binary at %s.', binary);
176 }
177
178 return binary;
179 }
180
181 if (browser === 'cft') {
182 const binary = downloadedChromeBinaryPath();
183 if (verbose) {
184 console.debug('Located Chrome for Testing binary at %s.', binary);
185 }
186 return binary;
187 }
188
189 if (['stable', 'beta', 'dev', 'canary'].includes(browser)) {
190 const binary = computeSystemExecutablePath({
191 browser: 'chrome',
192 channel: browser,
193 });
194
195 if (verbose) {
196 console.debug(`Located Chrome ${browser} binary at ${binary}.`);
197 }
198 return binary;
199 }
200
201 if (verbose) {
202 console.debug(`Launching custom binary at ${browser}.`);
203 }
204 return browser;

Callers 1

startFunction · 0.85

Calls 6

isInChromiumDirectoryFunction · 0.90
gnArgsForTargetFunction · 0.90
getMethod · 0.65
platformMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected