github.com/dlintw/docker@v1.5.0-rc4/utils/tmpdir.go (about) 1 package utils 2 3 import ( 4 "os" 5 "path/filepath" 6 ) 7 8 // TempDir returns the default directory to use for temporary files. 9 func TempDir(rootDir string) (string, error) { 10 var tmpDir string 11 if tmpDir = os.Getenv("DOCKER_TMPDIR"); tmpDir == "" { 12 tmpDir = filepath.Join(rootDir, "tmp") 13 } 14 err := os.MkdirAll(tmpDir, 0700) 15 return tmpDir, err 16 }