gitlab.com/apertussolutions/u-root@v7.0.0+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  }