mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-26 05:27:19 +00:00
21 lines
293 B
Go
21 lines
293 B
Go
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
|
|
}
|