Skip to content

Commit 029688a

Browse files
kalmiwhyrusleeping
authored andcommitted
use ipfs's fsrepo.BestKnownPath to locate the ipfs daemon
1 parent ba7d620 commit 029688a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

gxutil/shell.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package gxutil
22

33
import (
4-
"errors"
54
"io/ioutil"
65
"os"
76
"path/filepath"
87
"strings"
98

109
sh "github.com/ipfs/go-ipfs-api"
11-
hd "github.com/mitchellh/go-homedir"
1210
manet "github.com/jbenet/go-multiaddr-net"
1311
ma "github.com/jbenet/go-multiaddr-net/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
12+
homedir "github.com/mitchellh/go-homedir"
1413
log "github.com/whyrusleeping/stump"
1514
)
1615

@@ -32,9 +31,9 @@ func NewShell() *sh.Shell {
3231
func getLocalApiShell() (*sh.Shell, error) {
3332
ipath := os.Getenv("IPFS_PATH")
3433
if ipath == "" {
35-
home, err := hd.Dir()
34+
home, err := homedir.Dir()
3635
if err != nil {
37-
return nil, errors.New("neither IPFS_PATH nor home dir set")
36+
return nil, err
3837
}
3938

4039
ipath = filepath.Join(home, ".ipfs")

0 commit comments

Comments
 (0)