cmd/clef, cmd/geth: use SplitAndTrim from cmd/utils (#21579)

This commit is contained in:
Binacs
2020-09-23 05:22:54 +08:00
committed by GitHub
parent 129cf075e9
commit fdb742419e
4 changed files with 28 additions and 60 deletions

View File

@ -192,14 +192,14 @@ func GlobalBig(ctx *cli.Context, name string) *big.Int {
// Note, it has limitations, e.g. ~someuser/tmp will not be expanded
func expandPath(p string) string {
if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
if home := homeDir(); home != "" {
if home := HomeDir(); home != "" {
p = home + p[1:]
}
}
return path.Clean(os.ExpandEnv(p))
}
func homeDir() string {
func HomeDir() string {
if home := os.Getenv("HOME"); home != "" {
return home
}