Added Path utility

pull/150/head
obscuren 10 years ago
parent 7a9ff4f8d4
commit 3889785017
  1. 20
      ethutil/path.go

@ -0,0 +1,20 @@
package ethutil
import (
"os/user"
"strings"
)
func ExpandHomePath(p string) (path string) {
path = p
// Check in case of paths like "/something/~/something/"
if path[:2] == "~/" {
usr, _ := user.Current()
dir := usr.HomeDir
path = strings.Replace(p, "~", dir, 1)
}
return
}
Loading…
Cancel
Save