}
return &PathError{op, f.name, err}
}
+
+// TempDir returns the default directory to use for temporary files.
+//
+// On Unix systems, it returns $TMPDIR if non-empty, else /tmp.
+// On Windows, it uses GetTempPath, returning the first non-empty
+// value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.
+// On Plan 9, it returns /tmp.
+//
+// The directory is neither guaranteed to exist nor have accessible
+// permissions.
+func TempDir() string {
+ return tempDir()
+}
return &PathError{"chown", f.name, syscall.EPLAN9}
}
-// TempDir returns the default directory to use for temporary files.
-func TempDir() string {
+func tempDir() string {
return "/tmp"
}
return &PathError{"remove", name, e}
}
-// TempDir returns the default directory to use for temporary files.
-func TempDir() string {
+func tempDir() string {
dir := Getenv("TMPDIR")
if dir == "" {
if runtime.GOOS == "android" {
return newFile(p[0], "|0", "file"), newFile(p[1], "|1", "file"), nil
}
-// TempDir returns the default directory to use for temporary files.
-func TempDir() string {
+func tempDir() string {
n := uint32(syscall.MAX_PATH)
for {
b := make([]uint16, n)