rpc api: eth_getNatSpec
* xeth, rpc: implement eth_getNatSpec for tx confirmations * rename silly docserver -> httpclient * eth/backend: httpclient now accessible via eth.Ethereum init-d via config.DocRoot * cmd: introduce separate CLI flag for DocRoot (defaults to homedir) * common/path: delete unused assetpath func, separate HomeDir func
This commit is contained in:
@ -23,8 +23,6 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/kardianos/osext"
|
||||
)
|
||||
|
||||
// MakeName creates a node name that follows the ethereum convention
|
||||
@ -65,48 +63,18 @@ func AbsolutePath(Datadir string, filename string) string {
|
||||
return filepath.Join(Datadir, filename)
|
||||
}
|
||||
|
||||
func DefaultAssetPath() string {
|
||||
var assetPath string
|
||||
pwd, _ := os.Getwd()
|
||||
srcdir := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist")
|
||||
|
||||
// If the current working directory is the go-ethereum dir
|
||||
// assume a debug build and use the source directory as
|
||||
// asset directory.
|
||||
if pwd == srcdir {
|
||||
assetPath = filepath.Join(pwd, "assets")
|
||||
} else {
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
// Get Binary Directory
|
||||
exedir, _ := osext.ExecutableFolder()
|
||||
assetPath = filepath.Join(exedir, "..", "Resources")
|
||||
case "linux":
|
||||
assetPath = filepath.Join("usr", "share", "mist")
|
||||
case "windows":
|
||||
assetPath = filepath.Join(".", "assets")
|
||||
default:
|
||||
assetPath = "."
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the assetPath exists. If not, try the source directory
|
||||
// This happens when binary is run from outside cmd/mist directory
|
||||
if _, err := os.Stat(assetPath); os.IsNotExist(err) {
|
||||
assetPath = filepath.Join(srcdir, "assets")
|
||||
}
|
||||
|
||||
return assetPath
|
||||
}
|
||||
|
||||
func DefaultDataDir() string {
|
||||
// Try to place the data folder in the user's home dir
|
||||
var home string
|
||||
func HomeDir() (home string) {
|
||||
if usr, err := user.Current(); err == nil {
|
||||
home = usr.HomeDir
|
||||
} else {
|
||||
home = os.Getenv("HOME")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func DefaultDataDir() string {
|
||||
// Try to place the data folder in the user's home dir
|
||||
home := HomeDir()
|
||||
if home != "" {
|
||||
if runtime.GOOS == "darwin" {
|
||||
return filepath.Join(home, "Library", "Ethereum")
|
||||
|
Reference in New Issue
Block a user