diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-28 17:49:53 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-28 17:49:53 +0800 |
commit | 05f74077fb1bc23937f3b25fd4e826dcf5789212 (patch) | |
tree | e1fca4dd2efc253b00e2d39c3c554de87f8b78f9 /common/path.go | |
parent | 2e4fdce74334206dd4341028594bcef140d00b92 (diff) | |
parent | 4d005a2c1d2929dc770acd3a2bfed59495c70557 (diff) | |
download | dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.tar dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.tar.gz dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.tar.bz2 dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.tar.lz dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.tar.xz dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.tar.zst dexon-05f74077fb1bc23937f3b25fd4e826dcf5789212.zip |
Merge pull request #1919 from ethersphere/getnatspec
rpc api: eth_getNatSpec
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") |