From 4d005a2c1d2929dc770acd3a2bfed59495c70557 Mon Sep 17 00:00:00 2001 From: zelig Date: Mon, 26 Oct 2015 22:24:09 +0100 Subject: 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 --- common/path.go | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) (limited to 'common/path.go') diff --git a/common/path.go b/common/path.go index 1253c424c..39eacacee 100644 --- a/common/path.go +++ b/common/path.go @@ -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") +func HomeDir() (home string) { + if usr, err := user.Current(); err == nil { + home = usr.HomeDir } 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") + home = os.Getenv("HOME") } - - return assetPath + return } func DefaultDataDir() string { // Try to place the data folder in the user's home dir - var home string - if usr, err := user.Current(); err == nil { - home = usr.HomeDir - } else { - home = os.Getenv("HOME") - } + home := HomeDir() if home != "" { if runtime.GOOS == "darwin" { return filepath.Join(home, "Library", "Ethereum") -- cgit v1.2.3