Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Commit 2afe9a3

Browse files
lucacasonatoNathan Potter
authored and
Nathan Potter
committed
Added support for Chrome beta, dev and canary (#221)
* Support chrome beta, dev and canary * fixed canary dir for macos
1 parent 2125c9e commit 2afe9a3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

chrome.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ func (c *chromeExtInstall) Run(fl *flag.FlagSet) {
108108
}
109109

110110
for _, dir := range nativeHostDirs {
111+
if dir == "" {
112+
continue
113+
}
114+
111115
err = os.MkdirAll(dir, 0755)
112116
if err != nil {
113117
flog.Fatal("failed to ensure manifest directory exists: %v", err)
@@ -146,14 +150,20 @@ func nativeMessageHostManifestDirectories() ([]string, error) {
146150
}
147151

148152
var chromeDir string
153+
var chromeBetaDir string
154+
var chromeDevDir string
155+
var chromeCanaryDir string
149156
var chromiumDir string
150157

151158
switch runtime.GOOS {
152159
case "linux":
153160
chromeDir = path.Join(homeDir, ".config", "google-chrome", "NativeMessagingHosts")
161+
chromeBetaDir = path.Join(homeDir, ".config", "google-chrome-beta", "NativeMessagingHosts")
162+
chromeDevDir = path.Join(homeDir, ".config", "google-chrome-unstable", "NativeMessagingHosts")
154163
chromiumDir = path.Join(homeDir, ".config", "chromium", "NativeMessagingHosts")
155164
case "darwin":
156165
chromeDir = path.Join(homeDir, "Library", "Application Support", "Google", "Chrome", "NativeMessagingHosts")
166+
chromeCanaryDir = path.Join(homeDir, "Library", "Application Support", "Google", "Chrome Canary", "NativeMessagingHosts")
157167
chromiumDir = path.Join(homeDir, "Library", "Application Support", "Chromium", "NativeMessagingHosts")
158168
default:
159169
return nil, xerrors.Errorf("unsupported os %q", runtime.GOOS)
@@ -162,5 +172,8 @@ func nativeMessageHostManifestDirectories() ([]string, error) {
162172
return []string{
163173
chromeDir,
164174
chromiumDir,
175+
chromeBetaDir,
176+
chromeDevDir,
177+
chromeCanaryDir,
165178
}, nil
166179
}

0 commit comments

Comments
 (0)