diff options
| author | Eyal Posener <[email protected]> | 2017-05-23 19:33:44 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-23 19:33:44 +0300 |
| commit | 8a418a6ab0e75f89eb3c6e5ed76cca082914bb6d (patch) | |
| tree | b511c8d0fd4923b42e7dd5d3cb8c9e0ee08609f9 /cmd/install/install.go | |
| parent | 3e6cff0740a53c8e9d6106ad29a4fd1bc4536c99 (diff) | |
| parent | b74be9ff548cfaa7330b1a9312612a830282228d (diff) | |
Merge pull request #38 from josharian/fix-installer
Fix installer
Diffstat (limited to 'cmd/install/install.go')
| -rw-r--r-- | cmd/install/install.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/install/install.go b/cmd/install/install.go index 11581c1..fb44b2b 100644 --- a/cmd/install/install.go +++ b/cmd/install/install.go @@ -29,7 +29,7 @@ func Install(cmd string) error { for _, i := range is { errI := i.Install(cmd, bin) if errI != nil { - multierror.Append(err, errI) + err = multierror.Append(err, errI) } } @@ -59,8 +59,11 @@ func Uninstall(cmd string) error { } func installers() (i []installer) { - if f := rcFile(".bashrc"); f != "" { - i = append(i, bash{f}) + for _, rc := range [...]string{".bashrc", ".bash_profile"} { + if f := rcFile(rc); f != "" { + i = append(i, bash{f}) + break + } } if f := rcFile(".zshrc"); f != "" { i = append(i, zsh{f}) @@ -81,5 +84,9 @@ func rcFile(name string) string { if err != nil { return "" } - return filepath.Join(u.HomeDir, name) + path := filepath.Join(u.HomeDir, name) + if _, err := os.Stat(path); err != nil { + return "" + } + return path } |
