提交 38897850 编写于 作者: O obscuren

Added Path utility

上级 7a9ff4f8
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
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册