2018-02-05 16:05:59 -05:00
|
|
|
package ioutils // import "github.com/docker/docker/pkg/ioutils"
|
2015-09-06 13:26:40 -04:00
|
|
|
|
|
|
|
import (
|
2021-08-24 06:10:50 -04:00
|
|
|
"os"
|
2015-09-06 13:26:40 -04:00
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/longpath"
|
|
|
|
)
|
|
|
|
|
2021-08-24 06:10:50 -04:00
|
|
|
// TempDir is the equivalent of os.MkdirTemp, except that the result is in Windows longpath format.
|
2015-09-06 13:26:40 -04:00
|
|
|
func TempDir(dir, prefix string) (string, error) {
|
2021-08-24 06:10:50 -04:00
|
|
|
tempDir, err := os.MkdirTemp(dir, prefix)
|
2015-09-06 13:26:40 -04:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
return longpath.AddPrefix(tempDir), nil
|
|
|
|
}
|