github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/cmds/core/elvish/runtime/sys_windows.go (about) 1 package runtime 2 3 import ( 4 "fmt" 5 "os" 6 "path/filepath" 7 ) 8 9 // getSecureRunDir stats elvish-$USERNAME under the default temp dir, creating 10 // it if it doesn't yet exist, and return the directory name. 11 func getSecureRunDir() (string, error) { 12 username := os.Getenv("USERNAME") 13 14 runDir := filepath.Join(os.TempDir(), "elvish-"+username) 15 err := os.MkdirAll(runDir, 0700) 16 if err != nil { 17 return "", fmt.Errorf("mkdir: %v", err) 18 } 19 20 return runDir, nil 21 }