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>
47 lines
1.3 KiB
Markdown
47 lines
1.3 KiB
Markdown
# ``_NIOFileSystem/FileSystemProtocol``
|
|
|
|
## Topics
|
|
|
|
### Opening files with managed lifecycles
|
|
|
|
Files and directories can be opened and have their lifecycles managed by using the
|
|
following methods:
|
|
|
|
- ``withFileHandle(forReadingAt:options:execute:)-nsue``
|
|
- ``withFileHandle(forWritingAt:options:execute:)-1p6ka``
|
|
- ``withFileHandle(forReadingAndWritingAt:options:execute:)-9nqu3``
|
|
- ``withDirectoryHandle(atPath:options:execute:)-4wzzz``
|
|
|
|
### Opening files
|
|
|
|
Files and directories can be opened using the following methods. The caller is responsible for
|
|
closing it to avoid leaking resources.
|
|
|
|
- ``openFile(forReadingAt:)-6v2b8``
|
|
- ``openFile(forWritingAt:options:)``
|
|
- ``openFile(forReadingAndWritingAt:options:)``
|
|
- ``openDirectory(atPath:options:)``
|
|
|
|
### File information
|
|
|
|
- ``info(forFileAt:infoAboutSymbolicLink:)``
|
|
|
|
### Symbolic links
|
|
|
|
- ``createSymbolicLink(at:withDestination:)``
|
|
- ``destinationOfSymbolicLink(at:)``
|
|
|
|
### Managing files
|
|
|
|
- ``copyItem(at:to:strategy:shouldProceedAfterError:shouldCopyItem:)``
|
|
- ``removeItem(at:)-1vii4``
|
|
- ``moveItem(at:to:)``
|
|
- ``replaceItem(at:withItemAt:)``
|
|
- ``createDirectory(at:withIntermediateDirectories:permissions:)``
|
|
|
|
### System directories
|
|
|
|
- ``currentWorkingDirectory``
|
|
- ``temporaryDirectory``
|
|
- ``withTemporaryDirectory(prefix:options:execute:)-rbkk``
|