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+
15## 2.0.0
26
37## Breaking Changes
Original file line number Diff line number Diff line change @@ -16,14 +16,27 @@ const _linuxExecutable = 'google-chrome';
1616const _macOSExecutable =
1717 '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' ;
1818const _windowsExecutable = r'Google\Chrome\Application\chrome.exe' ;
19+ var _windowsPrefixes = [
20+ Platform .environment['LOCALAPPDATA' ],
21+ Platform .environment['PROGRAMFILES' ],
22+ Platform .environment['PROGRAMFILES(X86)' ]
23+ ];
1924
2025String get _executable {
2126 if (Platform .environment.containsKey (_chromeEnvironment)) {
2227 return Platform .environment[_chromeEnvironment];
2328 }
2429 if (Platform .isLinux) return _linuxExecutable;
2530 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+ }
2740 throw StateError ('Unexpected platform type.' );
2841}
2942
You can’t perform that action at this time.
0 commit comments