Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Sources/System/FileDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ extension FileDescriptor {
@_alwaysEmitIntoClient
@available(*, unavailable, renamed: "noFollow")
public static var O_NOFOLLOW: OpenOptions { noFollow }

/// Indicates that opening the file only succeeds if the file is a directory.
///
/// If you specify this option and the file path you pass to
/// <doc:System/FileDescriptor/open(_:_:options:permissions:)-10dcs>
/// is a not a directory, then that open operation fails.
///
/// The corresponding C constant is `O_DIRECTORY`.
@_alwaysEmitIntoClient
public static var directory: OpenOptions { OpenOptions(_O_DIRECTORY) }

@_alwaysEmitIntoClient
@available(*, unavailable, renamed: "directory")
public static var O_DIRECTORY: OpenOptions { directory }
#endif

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
Expand Down
1 change: 0 additions & 1 deletion Sources/System/Internals/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ internal var _O_EVTONLY: CInt { O_EVTONLY }
@_alwaysEmitIntoClient
internal var _O_NOCTTY: CInt { O_NOCTTY }

// TODO: API?
@_alwaysEmitIntoClient
internal var _O_DIRECTORY: CInt { O_DIRECTORY }
#endif
Expand Down