aboutsummaryrefslogblamecommitdiffstats
path: root/ethutil/path.go
blob: 97f58ab7e57d61f35d4b8298c156b6b86c2091bf (plain) (tree)



















                                                                
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
}