diff options
author | zelig <viktor.tron@gmail.com> | 2015-10-27 05:24:09 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-10-27 05:24:09 +0800 |
commit | 4d005a2c1d2929dc770acd3a2bfed59495c70557 (patch) | |
tree | 0442ccefd85cc8b692c2c58a5916bc997909657a /common/path.go | |
parent | 3b4ffacd0c63952ceda96b3fafb050c91e72b420 (diff) | |
download | dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.tar dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.tar.gz dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.tar.bz2 dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.tar.lz dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.tar.xz dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.tar.zst dexon-4d005a2c1d2929dc770acd3a2bfed59495c70557.zip |
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
Diffstat (limited to 'common/path.go')
-rw-r--r-- | common/path.go | 44 |
1 files changed, 6 insertions, 38 deletions
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") |