Adding additional Chrome environment variables for executable resolution. (#24)
* Adding additional Chrome environment variables to executable resolution.
* Updating changelog and version
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f9759a..42f89bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.1.9
+
+ - Add support for Chrome executables in `CHROME_PATH`.
+
## 0.1.8
- Log `STDERR` on Chrome launch failure.
diff --git a/lib/src/chrome.dart b/lib/src/chrome.dart
index bfa4270..04d0262 100644
--- a/lib/src/chrome.dart
+++ b/lib/src/chrome.dart
@@ -9,15 +9,17 @@
import 'package:path/path.dart' as p;
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
-const _chromeEnvironment = 'CHROME_EXECUTABLE';
+const _chromeEnvironments = ['CHROME_EXECUTABLE', 'CHROME_PATH'];
const _linuxExecutable = 'google-chrome';
const _macOSExecutable =
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
const _windowsExecutable = r'Google\Chrome\Application\chrome.exe';
String get _executable {
- if (Platform.environment.containsKey(_chromeEnvironment)) {
- return Platform.environment[_chromeEnvironment];
+ for (var chromeEnv in _chromeEnvironments) {
+ if (Platform.environment.containsKey(chromeEnv)) {
+ return Platform.environment[chromeEnv];
+ }
}
if (Platform.isLinux) return _linuxExecutable;
if (Platform.isMacOS) return _macOSExecutable;
diff --git a/pubspec.yaml b/pubspec.yaml
index 1d8367b..186703f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: browser_launcher
description: Provides a standardized way to launch web browsers for testing and tools.
-version: 0.1.8
+version: 0.1.9
homepage: https://github.com/dart-lang/browser_launcher