good morning!!!!

Skip to content
Snippets Groups Projects
Commit dcbd97d2 authored by Maran Hidskes's avatar Maran Hidskes
Browse files

Check current folder for mnemonic words if it fails in source folder. For binary support

parent 794e65b6
Branches
Tags
No related merge requests found
...@@ -3,7 +3,9 @@ package ethcrypto ...@@ -3,7 +3,9 @@ package ethcrypto
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os"
"path" "path"
"path/filepath"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
...@@ -12,6 +14,14 @@ import ( ...@@ -12,6 +14,14 @@ import (
func InitWords() []string { func InitWords() []string {
_, thisfile, _, _ := runtime.Caller(1) _, thisfile, _, _ := runtime.Caller(1)
filename := path.Join(path.Dir(thisfile), "mnemonic.words.lst") 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) content, err := ioutil.ReadFile(filename)
if err != nil { if err != nil {
panic(fmt.Errorf("reading mnemonic word list file 'mnemonic.words.lst' failed: ", err)) panic(fmt.Errorf("reading mnemonic word list file 'mnemonic.words.lst' failed: ", err))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment