Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit 12ab9f3

Browse files
authored
Adding additional Chrome environment variables for executable resolution. (#24)
* Adding additional Chrome environment variables to executable resolution. * Updating changelog and version
1 parent 3e1677b commit 12ab9f3

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.9
2+
3+
- Add support for Chrome executables in `CHROME_PATH`.
4+
15
## 0.1.8
26

37
- Log `STDERR` on Chrome launch failure.

lib/src/chrome.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ import 'dart:io';
99
import 'package:path/path.dart' as p;
1010
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
1111

12-
const _chromeEnvironment = 'CHROME_EXECUTABLE';
12+
const _chromeEnvironments = ['CHROME_EXECUTABLE', 'CHROME_PATH'];
1313
const _linuxExecutable = 'google-chrome';
1414
const _macOSExecutable =
1515
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
1616
const _windowsExecutable = r'Google\Chrome\Application\chrome.exe';
1717

1818
String get _executable {
19-
if (Platform.environment.containsKey(_chromeEnvironment)) {
20-
return Platform.environment[_chromeEnvironment];
19+
for (var chromeEnv in _chromeEnvironments) {
20+
if (Platform.environment.containsKey(chromeEnv)) {
21+
return Platform.environment[chromeEnv];
22+
}
2123
}
2224
if (Platform.isLinux) return _linuxExecutable;
2325
if (Platform.isMacOS) return _macOSExecutable;

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: browser_launcher
22
description: Provides a standardized way to launch web browsers for testing and tools.
33

4-
version: 0.1.8
4+
version: 0.1.9
55

66
homepage: https://github.com/dart-lang/browser_launcher
77

0 commit comments

Comments
 (0)