github.com/zhouyu0/docker-note@v0.0.0-20190722021225-b8d3825084db/pkg/homedir/homedir_windows.go (about)

     1  package homedir // import "github.com/docker/docker/pkg/homedir"
     2  
     3  import (
     4  	"os"
     5  )
     6  
     7  // Key returns the env var name for the user's home dir based on
     8  // the platform being run on
     9  func Key() string {
    10  	return "USERPROFILE"
    11  }
    12  
    13  // Get returns the home directory of the current user with the help of
    14  // environment variables depending on the target operating system.
    15  // Returned path should be used with "path/filepath" to form new paths.
    16  func Get() string {
    17  	return os.Getenv(Key())
    18  }
    19  
    20  // GetShortcutString returns the string that is shortcut to user's home directory
    21  // in the native shell of the platform running on.
    22  func GetShortcutString() string {
    23  	return "%USERPROFILE%" // be careful while using in format functions
    24  }