fix path miss in windows/add a new api create function (#23)

* fix path was not always correct in windows

* add new api create function for if the port was different with api file.

* Update api.go

remove no need commit


This commit was moved from ipfs/go-ipfs-http-client@8c87debb12
This commit is contained in:
godcong 2019-08-13 07:16:47 +08:00 committed by Steven Allen
parent 9345cfa7b8
commit be8f80237d

View File

@ -7,12 +7,12 @@ import (
"net/http"
gohttp "net/http"
"os"
"path"
"path/filepath"
"strings"
iface "github.com/ipfs/interface-go-ipfs-core"
caopts "github.com/ipfs/interface-go-ipfs-core/options"
homedir "github.com/mitchellh/go-homedir"
"github.com/mitchellh/go-homedir"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
)
@ -73,7 +73,7 @@ func ApiAddr(ipfspath string) (ma.Multiaddr, error) {
return nil, err
}
apiFile := path.Join(baseDir, DefaultApiFile)
apiFile := filepath.Join(baseDir, DefaultApiFile)
api, err := ioutil.ReadFile(apiFile)
if err != nil {