@@ -105,10 +105,22 @@ def chrome_on_linux_path(chromium_ok=False, browser_type=None):
105105 return ""
106106 if os_name () != OSType .LINUX :
107107 return ""
108- paths = ["/bin/google-chrome" , "/bin/google-chrome-stable" ]
108+ paths = [
109+ "/bin/google-chrome" ,
110+ "/bin/google-chrome-stable" ,
111+ "/usr/bin/google-chrome" ,
112+ "/usr/bin/google-chrome-stable"
113+ ]
109114 for path in paths :
110- if os .path .exists (path ) and os .access (path , os .X_OK ):
111- return path
115+ try :
116+ if (
117+ os .path .exists (path )
118+ and os .access (path , os .R_OK )
119+ and os .access (path , os .X_OK )
120+ ):
121+ return path
122+ except Exception :
123+ pass
112124 paths = os .environ ["PATH" ].split (os .pathsep )
113125 binaries = []
114126 binaries .append ("google-chrome" )
@@ -122,13 +134,32 @@ def chrome_on_linux_path(chromium_ok=False, browser_type=None):
122134 for binary in binaries :
123135 for path in paths :
124136 full_path = os .path .join (path , binary )
125- if os .path .exists (full_path ) and os .access (full_path , os .X_OK ):
126- return full_path
137+ try :
138+ if (
139+ os .path .exists (full_path )
140+ and os .access (full_path , os .R_OK )
141+ and os .access (full_path , os .X_OK )
142+ ):
143+ return full_path
144+ except Exception :
145+ pass
127146 if chromium_ok :
128- paths = ["/bin/chromium" , "/bin/chromium-browser" ]
147+ paths = [
148+ "/bin/chromium" ,
149+ "/bin/chromium-browser" ,
150+ "/usr/bin/chromium" ,
151+ "/usr/bin/chromium-browser"
152+ ]
129153 for path in paths :
130- if os .path .exists (path ) and os .access (path , os .X_OK ):
131- return path
154+ try :
155+ if (
156+ os .path .exists (path )
157+ and os .access (path , os .R_OK )
158+ and os .access (path , os .X_OK )
159+ ):
160+ return path
161+ except Exception :
162+ pass
132163 return "/usr/bin/google-chrome"
133164
134165
0 commit comments