7 "github.com/fsouza/go-dockerclient/external/github.com/opencontainers/runc/libcontainer/user"
10 // Key returns the env var name for the user's home dir based on
11 // the platform being run on
13 if runtime.GOOS == "windows" {
19 // Get returns the home directory of the current user with the help of
20 // environment variables depending on the target operating system.
21 // Returned path should be used with "path/filepath" to form new paths.
23 home := os.Getenv(Key())
24 if home == "" && runtime.GOOS != "windows" {
25 if u, err := user.CurrentUser(); err == nil {
32 // GetShortcutString returns the string that is shortcut to user's home directory
33 // in the native shell of the platform running on.
34 func GetShortcutString() string {
35 if runtime.GOOS == "windows" {
36 return "%USERPROFILE%" // be careful while using in format functions