Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions chrome.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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, "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)
Expand All @@ -162,5 +172,8 @@ func nativeMessageHostManifestDirectories() ([]string, error) {
return []string{
chromeDir,
chromiumDir,
chromeBetaDir,
chromeDevDir,
chromeCanaryDir,
}, nil
}