From b591dfb5375bfdc387e935a744dfdbb9b24a4bdc Mon Sep 17 00:00:00 2001 From: er0k Date: Fri, 2 May 2025 15:59:30 -0400 Subject: [PATCH] set correct paths for macos manifest installation fixes #43 fixes #110 --- brotab/main.py | 19 +++++++++++++++---- brotab/platform.py | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/brotab/main.py b/brotab/main.py index c0c37b7..26bbcd9 100644 --- a/brotab/main.py +++ b/brotab/main.py @@ -377,15 +377,26 @@ def install_mediator(args): if is_windows(): bt_mediator_path = make_windows_path_double_sep(bt_mediator_path) + mozilla_path = '~/.mozilla/native-messaging-hosts/' + chrome_path = '~/.config/google-chrome/NativeMessagingHosts' + chromium_path = '~/.config/chromium/NativeMessagingHosts' + brave_path = '~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/' + + if is_macos(): + mozilla_path = '~/Library/Application Support/Mozilla/' + chrome_path = '~/Library/Application Support/Google/Chrome/' + chromium_path = '~/Library/Application Support/Chromium/' + brave_path = chrome_path + native_app_manifests = [ ('mediator/firefox_mediator.json', - '~/.mozilla/native-messaging-hosts/brotab_mediator.json'), + f"{mozilla_path}/brotab_mediator.json"), ('mediator/chromium_mediator.json', - '~/.config/chromium/NativeMessagingHosts/brotab_mediator.json'), + f"{chromium_path}/brotab_mediator.json"), ('mediator/chromium_mediator.json', - '~/.config/google-chrome/NativeMessagingHosts/brotab_mediator.json'), + f"{chrome_path}/brotab_mediator.json"), ('mediator/chromium_mediator.json', - '~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/brotab_mediator.json'), + f"{brave_path}/brotab_mediator.json"), ] if args.tests: diff --git a/brotab/platform.py b/brotab/platform.py index 0689653..e1ebec0 100644 --- a/brotab/platform.py +++ b/brotab/platform.py @@ -46,6 +46,8 @@ def register_native_manifest_windows_firefox(manifest_filename): def is_windows() -> bool: return platform.system() == 'Windows' +def is_macos() -> bool: + return platform.system() == 'Darwin' def get_editor() -> str: mapping = {