exclusiveCreate
Indicates that opening the file creates the file, expecting that it doesn’t exist.
Declaration
static var exclusiveCreate: FileDescriptor.OpenOptions { get }Mentioned in
Discussion
If this option and create are both specified and the file exists, doc:FileDescriptor/open(_:_:options:permissions:retryOnInterrupt:)-2266j returns an error instead of creating the file. You can use this, for example, to implement a simple exclusive-access locking mechanism.
If this option and create are both specified and the last component of the file’s path is a symbolic link, doc:FileDescriptor/open(_:_:options:permissions:retryOnInterrupt:)-2266j fails even if the symbolic link points to a nonexistent name.
The corresponding C constant is O_EXCL.