aboutsummaryrefslogtreecommitdiffstats
path: root/ethcrypto/mnemonic.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-07-09 16:59:49 +0800
committerMaran <maran.hidskes@gmail.com>2014-07-09 16:59:49 +0800
commitdcbd97d29c35913c0d13d5da434cb3567fc98ee6 (patch)
tree7b5ead2810d9e102bf5a1c1eb81d5367c91926a7 /ethcrypto/mnemonic.go
parent794e65b60e3d9cd954f9d2aa082d18fe9431c200 (diff)
downloadgo-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.tar
go-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.tar.gz
go-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.tar.bz2
go-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.tar.lz
go-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.tar.xz
go-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.tar.zst
go-tangerine-dcbd97d29c35913c0d13d5da434cb3567fc98ee6.zip
Check current folder for mnemonic words if it fails in source folder. For binary support
Diffstat (limited to 'ethcrypto/mnemonic.go')
-rw-r--r--ethcrypto/mnemonic.go10
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))