createTempDir
Deprecated
Avoid creating temporary directories in the default temp location with this function due to too wide permissions on the newly created directory. Use kotlin.io.path.createTempDirectory instead.
Creates an empty directory in the specified directory, using the given prefix and suffix to generate its name.
If prefix is not specified then some unspecified string will be used. If suffix is not specified then ".tmp" will be used. If directory is not specified then the default temporary-file directory will be used.
The prefix argument, if specified, must be at least three characters long. It is recommended that the prefix be a short, meaningful string such as "job" or "mail".
To create the new file, the prefix and the suffix may first be adjusted to fit the limitations of the underlying platform.
Note: if the new directory is created in a directory that is shared with all users, it may get permissions allowing everyone to read it or its content, thus creating a risk of leaking sensitive information stored in this directory. To avoid this, it's recommended either to specify an explicit parent directory that is not shared widely, or to use alternative ways of creating temporary files, such as java.nio.file.Files.createTempDirectory or the experimental createTempDirectory
function in the kotlin.io.path
package.
Since Kotlin
1.0Return
a file object corresponding to a newly-created directory.
Throws
in case of input/output error.
if prefix is shorter than three symbols.