From 833c8736c7cd696d832c110d68962a1ce9c05c44 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 19 Jun 2019 21:55:07 +0000 Subject: [PATCH 1/2] Support chrome beta, dev and canary --- chrome.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/chrome.go b/chrome.go index cd603d4..f99085f 100644 --- a/chrome.go +++ b/chrome.go @@ -108,6 +108,10 @@ func (c *chromeExtInstall) Run(fl *flag.FlagSet) { } for _, dir := range nativeHostDirs { + if dir == "" { + continue + } + err = os.MkdirAll(dir, 0755) if err != nil { flog.Fatal("failed to ensure manifest directory exists: %v", err) @@ -146,14 +150,20 @@ func nativeMessageHostManifestDirectories() ([]string, error) { } var chromeDir string + var chromeBetaDir string + var chromeDevDir string + var chromeCanaryDir string var chromiumDir string switch runtime.GOOS { case "linux": chromeDir = path.Join(homeDir, ".config", "google-chrome", "NativeMessagingHosts") + chromeBetaDir = path.Join(homeDir, ".config", "google-chrome-beta", "NativeMessagingHosts") + chromeDevDir = path.Join(homeDir, ".config", "google-chrome-unstable", "NativeMessagingHosts") chromiumDir = path.Join(homeDir, ".config", "chromium", "NativeMessagingHosts") case "darwin": chromeDir = path.Join(homeDir, "Library", "Application Support", "Google", "Chrome", "NativeMessagingHosts") + chromeCanaryDir = path.Join(homeDir, ".config", "google-chrome-unstable", "NativeMessagingHosts") chromiumDir = path.Join(homeDir, "Library", "Application Support", "Chromium", "NativeMessagingHosts") default: return nil, xerrors.Errorf("unsupported os %q", runtime.GOOS) @@ -162,5 +172,8 @@ func nativeMessageHostManifestDirectories() ([]string, error) { return []string{ chromeDir, chromiumDir, + chromeBetaDir, + chromeDevDir, + chromeCanaryDir, }, nil } From d8cfeb39aa4629c10a93fcc7020428038fc62a6b Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 19 Jun 2019 22:05:51 +0000 Subject: [PATCH 2/2] fixed canary dir for macos --- chrome.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome.go b/chrome.go index f99085f..cbfd58b 100644 --- a/chrome.go +++ b/chrome.go @@ -163,7 +163,7 @@ func nativeMessageHostManifestDirectories() ([]string, error) { chromiumDir = path.Join(homeDir, ".config", "chromium", "NativeMessagingHosts") case "darwin": chromeDir = path.Join(homeDir, "Library", "Application Support", "Google", "Chrome", "NativeMessagingHosts") - chromeCanaryDir = path.Join(homeDir, ".config", "google-chrome-unstable", "NativeMessagingHosts") + chromeCanaryDir = path.Join(homeDir, "Library", "Application Support", "Google", "Chrome Canary", "NativeMessagingHosts") chromiumDir = path.Join(homeDir, "Library", "Application Support", "Chromium", "NativeMessagingHosts") default: return nil, xerrors.Errorf("unsupported os %q", runtime.GOOS)