File tree Expand file tree Collapse file tree 5 files changed +265
-246
lines changed Expand file tree Collapse file tree 5 files changed +265
-246
lines changed Original file line number Diff line number Diff line change
1
+ ## 2.0.1
2
+
3
+ - Fix launching Chrome on Windows.
4
+
1
5
## 2.0.0
2
6
3
7
## Breaking Changes
Original file line number Diff line number Diff line change @@ -16,14 +16,27 @@ const _linuxExecutable = 'google-chrome';
16
16
const _macOSExecutable =
17
17
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' ;
18
18
const _windowsExecutable = r'Google\Chrome\Application\chrome.exe' ;
19
+ var _windowsPrefixes = [
20
+ Platform .environment['LOCALAPPDATA' ],
21
+ Platform .environment['PROGRAMFILES' ],
22
+ Platform .environment['PROGRAMFILES(X86)' ]
23
+ ];
19
24
20
25
String get _executable {
21
26
if (Platform .environment.containsKey (_chromeEnvironment)) {
22
27
return Platform .environment[_chromeEnvironment];
23
28
}
24
29
if (Platform .isLinux) return _linuxExecutable;
25
30
if (Platform .isMacOS) return _macOSExecutable;
26
- if (Platform .isWindows) return _windowsExecutable;
31
+ if (Platform .isWindows) {
32
+ return p.join (
33
+ _windowsPrefixes.firstWhere ((prefix) {
34
+ if (prefix == null ) return false ;
35
+ var path = p.join (prefix, _windowsExecutable);
36
+ return File (path).existsSync ();
37
+ }, orElse: () => '.' ),
38
+ _windowsExecutable);
39
+ }
27
40
throw StateError ('Unexpected platform type.' );
28
41
}
29
42
You can’t perform that action at this time.
0 commit comments