mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: Currently, file paths are represented by the `SystemPackage.FilePath` type in `NIOFileSystem`. Following from #3322, we want to use `NIOFilePath` instead. Modifications: This change provides `NIOFilePath` accepting/returning variants to all existing public methods that accept/return `SystemPackage.FilePath`. The bulk of the changes are in `FileSystemProtocol` and `FileHandleProtocol`, and their conforming types. The protocols have been modified to require `NIOFilePath` accepting/returning methods. Default implementations are provided for `SystemPackage.FilePath` accepting/returning methods---these call through to the `NIOFilePath` variants. Result: `NIOFilePath` path representations can now be used with the methods for interacting with the file system. --------- Co-authored-by: George Barnett <gbarnett@apple.com>
900 B
900 B
_NIOFileSystem/DirectoryFileHandleProtocol
Topics
Iterating a directory
listContents()
Opening files with managed lifecycles
Open files and directories at paths relative to the directory handle. These methods manage
the lifecycle of the handles by closing them when the execute closure returns.
withFileHandle(forReadingAt:options:execute:)-52xsnwithFileHandle(forWritingAt:options:execute:)-36f0kwithFileHandle(forReadingAndWritingAt:options:execute:)-5j0f3withDirectoryHandle(atPath:options:execute:)-2jszb
Opening files
Open files and directories at paths relative to the directory handle. These methods return the handle to the caller who is responsible for closing it.
openFile(forReadingAt:options:)openFile(forWritingAt:options:)openFile(forReadingAndWritingAt:options:)openDirectory(atPath:options:)