Commit Graph
2 Commits
Author SHA1 Message Date
aryan-25andGeorge Barnett 8997a24524 Update FilePath references to NIOFilePath (#3333)
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>
2025-08-11 17:29:02 +01:00
30e1f2e3f4 feat: Add String(contentsOf: FilePath ...) (#3048)
### Motivation:

Makes it possible to read contents of an NIOFileSystem.FilePath into a
String directly. Closes #3010.

### Modifications:

- Added a new `String+FileSystem.swift` into `NIOFileSystem` target.
- Added basic tests to the existing `ConvenienceTests.swift`.
- Added a test to cover `Array+FileSystem` initializer as well.

### Result:

- String initializer for `FilePath` is now available
- Array initializer for `FilePath` now has a test

---------

Co-authored-by: George Barnett <gbarnett@apple.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
2025-01-16 12:25:15 +00:00