TempDirectory
Interface representing a temporary directory.
This object provides the path to the created directory along with an open file descriptor or file handle. It automatically deletes the directory when close is called.
Use createTempDirectory to create temporary directory from common code. Additional factories for platform-specific implementations are available on target platforms, offering more flexible customization and usage capabilities.
The absolutePath method returns the absolute path of the temporary directory.
This object implements AutoCloseable, call close when the directory is no longer needed. The directory is automatically recursively deleted when close is called. Set TempDirectory.deleteOnClose to false to preserve the directory; however, close must still be called.
The open file descriptor or directory handle is available through the TempDirectory.root property. It can be used with platform-specific filesystem functions (for example, openat2()
on Linux).
Properties
Specifies whether the temporary directory should be deleted when close is called.
Functions
Returns the absolute path of the temporary directory.
Appends name to the absolutePath using the platform-specific file system separator and returns the complete path for name within the temporary directory.