|
@@ -1,12 +1,16 @@
|
|
-// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
|
|
|
|
-
|
|
|
|
package utils
|
|
package utils
|
|
|
|
|
|
import (
|
|
import (
|
|
"os"
|
|
"os"
|
|
|
|
+ "path/filepath"
|
|
)
|
|
)
|
|
|
|
|
|
// TempDir returns the default directory to use for temporary files.
|
|
// TempDir returns the default directory to use for temporary files.
|
|
-func TempDir(rootdir string) (string error) {
|
|
|
|
- return os.TempDir(), nil
|
|
|
|
|
|
+func TempDir(rootDir string) (string, error) {
|
|
|
|
+ var tmpDir string
|
|
|
|
+ if tmpDir = os.Getenv("DOCKER_TMPDIR"); tmpDir == "" {
|
|
|
|
+ tmpDir = filepath.Join(rootDir, "tmp")
|
|
|
|
+ }
|
|
|
|
+ err := os.MkdirAll(tmpDir, 0700)
|
|
|
|
+ return tmpDir, err
|
|
}
|
|
}
|