remove any reference to TMPDIR_SUFFIX. Using system tempdir is enough

This commit is contained in:
Adrien Delorme 2018-12-12 18:52:25 +01:00
parent b7222d1f56
commit cecf352aa7
2 changed files with 8 additions and 15 deletions

View File

@ -1,28 +1,25 @@
// Package tmp provides temporary directory helpers.
//
// tmp stores temporary items in the system's
// temporary directory ( see os.TempDir ).
// temporary directory ( see os.TempDir ) unless
// a corresponding environment variable is set.git
//
// When the $TMPDIR_SUFFIX environment variable
// is set, tmp will return paths under $TMPDIR_SUFFIX
// inside the system temporary directory.
// On Unix systems, it uses $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.
package tmp
import (
"io/ioutil"
"os"
"path/filepath"
)
var tmpDir = os.TempDir()
func init() {
if d := os.Getenv("TMPDIR_SUFFIX"); d != "" {
tmpDir = filepath.Join(tmpDir, d)
}
}
// Dir creates a new temporary directory in the system temporary
// directory with a name beginning with prefix and returns the path
// of the new directory.

View File

@ -48,7 +48,3 @@ each can be found below:
might be necessary to customize it when working with large files since
`/tmp` is a memory-backed filesystem in some Linux distributions in which
case `/var/tmp` might be preferred.
- `TMPDIR_SUFFIX` - When set, packer will put temporary files under system
temporary directory + `TMPDIR_SUFFIX`. This allows to create & to give
specific rights to a directory ie: `chmod 777 $TMPDIR/$TMPDIR_SUFFIX/`