(
&mut self,
reg_key: &'static str,
reg_version_arg: &'static str,
cmd_version_arg: &str,
)
| 1221 | } |
| 1222 | |
| 1223 | fn general_discover_browser_version( |
| 1224 | &mut self, |
| 1225 | reg_key: &'static str, |
| 1226 | reg_version_arg: &'static str, |
| 1227 | cmd_version_arg: &str, |
| 1228 | ) -> Result<Option<String>, Error> { |
| 1229 | let mut browser_path = self.get_browser_path().to_string(); |
| 1230 | if browser_path.is_empty() { |
| 1231 | if let Some(path) = self.detect_browser_path() { |
| 1232 | browser_path = path_to_string(&path); |
| 1233 | } |
| 1234 | } else if !Path::new(&browser_path).exists() { |
| 1235 | self.set_fallback_driver_from_cache(false); |
| 1236 | return Err(anyhow!(format_one_arg( |
| 1237 | "Browser path does not exist: {}", |
| 1238 | &browser_path, |
| 1239 | ))); |
| 1240 | } |
| 1241 | let escaped_browser_path = self.get_escaped_path(browser_path.to_string()); |
| 1242 | |
| 1243 | let mut commands = Vec::new(); |
| 1244 | if WINDOWS.is(self.get_os()) { |
| 1245 | if !escaped_browser_path.is_empty() && !self.is_webview2() { |
| 1246 | return Ok(get_win_file_version(&escaped_browser_path)); |
| 1247 | } |
| 1248 | if !self.is_browser_version_unstable() { |
| 1249 | let reg_command = Command::new( |
| 1250 | "REG", |
| 1251 | vec![ |
| 1252 | String::from("QUERY"), |
| 1253 | reg_key.to_string(), |
| 1254 | String::from("/v"), |
| 1255 | reg_version_arg.to_string(), |
| 1256 | ], |
| 1257 | ); |
| 1258 | commands.push(reg_command); |
| 1259 | } |
| 1260 | } else if !escaped_browser_path.is_empty() { |
| 1261 | commands.push(Command::new( |
| 1262 | escaped_browser_path, |
| 1263 | vec![cmd_version_arg.to_string()], |
| 1264 | )); |
| 1265 | } |
| 1266 | |
| 1267 | Ok(self.detect_browser_version(commands)) |
| 1268 | } |
| 1269 | |
| 1270 | fn discover_safari_version(&mut self, safari_path: String) -> Result<Option<String>, Error> { |
| 1271 | let mut browser_path = self.get_browser_path().to_string(); |
no test coverage detected