gotty/pkg/homedir/expand.go

14 lines
160 B
Go
Raw Normal View History

2017-02-26 06:37:07 +08:00
package homedir
import (
"os"
)
2017-02-26 06:37:07 +08:00
func Expand(path string) string {
if path[0:2] == "~/" {
return os.Getenv("HOME") + path[1:]
} else {
return path
}
}