mirror of https://github.com/ethereum/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
293 B
21 lines
293 B
11 years ago
|
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
|
||
|
}
|