From 9c1d652299d40fbf966892cf1090c452c4e3b2b5 Mon Sep 17 00:00:00 2001 From: Michael Weems <470705+weems@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:30:05 -0600 Subject: [PATCH] Update install.py (#369) Updating to Check Location of Firefox Install --- install.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install.py b/install.py index 1cb7f25..5d93fd9 100644 --- a/install.py +++ b/install.py @@ -123,7 +123,16 @@ def _get_latest_compatible_release(releases): if firefox_version in release["supported"]: return release return None - +def _get_firefox_version(bin="firefox"): + try: + ver_string = check_output([bin, "--version"], encoding="UTF-8") + return ver_string[ver_string.rindex(" ")+1:].strip() + except FileNotFoundError: + default_path = str(DEFAULT_FIREFOX_INSTALL.joinpath("firefox")) + if bin != default_path: # Avoid infinite recursion + return _get_firefox_version(default_path) + else: + raise Exception("Firefox binary not found. Please ensure Firefox is installed and the path is correct.") def backup_profile(src): dest = f"{src}-backup-{datetime.today().strftime('%Y-%m-%d-%H-%M-%S')}"