File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ var os = require ( 'os' ) ,
2+ fs = require ( 'fs' ) ;
3+
14var ChromeBrowser = function ( baseBrowserDecorator , args ) {
25 baseBrowserDecorator ( this ) ;
36
@@ -22,7 +25,7 @@ ChromeBrowser.prototype = {
2225 DEFAULT_CMD : {
2326 linux : 'google-chrome' ,
2427 darwin : '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' ,
25- win32 : process . env . LOCALAPPDATA + '\\Google\\Chrome\\Application\\chrome.exe'
28+ win32 : windowsChromePath ( '\\Google\\Chrome\\Application\\chrome.exe' )
2629 } ,
2730 ENV_CMD : 'CHROME_BIN'
2831} ;
@@ -46,13 +49,26 @@ ChromeCanaryBrowser.prototype = {
4649 DEFAULT_CMD : {
4750 linux : 'google-chrome-canary' ,
4851 darwin : '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary' ,
49- win32 : process . env . LOCALAPPDATA + '\\Google\\Chrome SxS\\Application\\chrome.exe'
52+ win32 : windowsChromePath ( '\\Google\\Chrome SxS\\Application\\chrome.exe' )
5053 } ,
5154 ENV_CMD : 'CHROME_CANARY_BIN'
5255} ;
5356
5457ChromeCanaryBrowser . $inject = [ 'baseBrowserDecorator' , 'args' ] ;
5558
59+ var windowsChromePath = function ( chromeExe ) {
60+ if ( os . platform ( ) !== 'win32' ) {
61+ return '' ;
62+ }
63+
64+ var globalInstall = os . arch ( ) === 'x64' ? process . env [ 'ProgramFiles(x86)' ] : process . env . ProgramFiles ;
65+
66+ if ( fs . existsSync ( globalInstall + chromeExe ) ) {
67+ return globalInstall + chromeExe ;
68+ }
69+
70+ return process . env . LOCALAPPDATA + chromeExe ;
71+ }
5672
5773// PUBLISH DI MODULE
5874module . exports = {
You can’t perform that action at this time.
0 commit comments