createTemporaryDirectory(template:)

Create a temporary directory at the given path, using a template.

FileSystem.swift:263
iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
func createTemporaryDirectory(template: FilePath) async throws -> FilePath

Parameters

template

The template for the path of the temporary directory.

Returns

  • The path to the new temporary directory.

Errors

Error codes thrown include:

  • invalidArgument if the template doesn’t end in at least 3 ‘X’s.

  • permissionDenied if the user doesn’t have permission to create a directory at the path specified in the template.

Implementation details

Uses the mkdir(2) system call.