diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-02 21:06:08 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-02 21:06:08 +0800 |
commit | 4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8 (patch) | |
tree | 1cc4369855586a5b59406d09299e89f8e3f9142d /ethutil/common.go | |
parent | cfe037028081ebb84ee35caa5b16fed5d125b58a (diff) | |
parent | 65cad14f9b27db396d036f47814d4843d947ac43 (diff) | |
download | go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.tar go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.tar.gz go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.tar.bz2 go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.tar.lz go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.tar.xz go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.tar.zst go-tangerine-4cb0bfe9395f3a45fcea00bc753cbd2c20ca78e8.zip |
Merge branch 'develop' of github.com:ethereum/go-ethereum into removews
Conflicts:
cmd/ethereum/flags.go
cmd/mist/flags.go
Diffstat (limited to 'ethutil/common.go')
-rw-r--r-- | ethutil/common.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ethutil/common.go b/ethutil/common.go index c4e7415dc..9b66763b8 100644 --- a/ethutil/common.go +++ b/ethutil/common.go @@ -15,11 +15,13 @@ import ( func DefaultAssetPath() string { var assetPath string + pwd, _ := os.Getwd() + srcdir := path.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. - pwd, _ := os.Getwd() - if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist") { + if pwd == srcdir { assetPath = path.Join(pwd, "assets") } else { switch runtime.GOOS { @@ -35,6 +37,13 @@ func DefaultAssetPath() string { 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 = path.Join(srcdir, "assets") + } + return assetPath } |