diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-10 21:06:55 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-10 21:06:55 +0800 |
commit | d6753b28836840f48d46a107f029d5d4f59a1d4b (patch) | |
tree | 5e61f71d2c70012005eadb90feab3ff974f5600d | |
parent | b7ff773ecf78f8dd66a6615fc608cabee5a35ce6 (diff) | |
parent | dcbd97d29c35913c0d13d5da434cb3567fc98ee6 (diff) | |
download | dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.tar dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.tar.gz dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.tar.bz2 dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.tar.lz dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.tar.xz dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.tar.zst dexon-d6753b28836840f48d46a107f029d5d4f59a1d4b.zip |
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
-rw-r--r-- | ethcrypto/mnemonic.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ethcrypto/mnemonic.go b/ethcrypto/mnemonic.go index 6134f85f7..725846792 100644 --- a/ethcrypto/mnemonic.go +++ b/ethcrypto/mnemonic.go @@ -3,7 +3,9 @@ package ethcrypto import ( "fmt" "io/ioutil" + "os" "path" + "path/filepath" "runtime" "strconv" "strings" @@ -12,6 +14,14 @@ import ( func InitWords() []string { _, thisfile, _, _ := runtime.Caller(1) filename := path.Join(path.Dir(thisfile), "mnemonic.words.lst") + if _, err := os.Stat(filename); os.IsNotExist(err) { + fmt.Printf("reading mnemonic word list file 'mnemonic.words.lst' from source folder failed, looking in current folder.") + dir, err := filepath.Abs(filepath.Dir(os.Args[0])) + if err != nil { + panic(fmt.Errorf("problem getting current folder: ", err)) + } + filename = path.Join(dir, "mnemonic.words.lst") + } content, err := ioutil.ReadFile(filename) if err != nil { panic(fmt.Errorf("reading mnemonic word list file 'mnemonic.words.lst' failed: ", err)) |