diff --git a/Sources/System/FilePath/FilePathComponentView.swift b/Sources/System/FilePath/FilePathComponentView.swift index a79c3ab..7b5394b 100644 --- a/Sources/System/FilePath/FilePathComponentView.swift +++ b/Sources/System/FilePath/FilePathComponentView.swift @@ -9,6 +9,7 @@ // MARK: - API +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// A bidirectional, range replaceable collection of the non-root components /// that make up a file path. @@ -97,6 +98,7 @@ extension FilePath.ComponentView: BidirectionalCollection { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.ComponentView: RangeReplaceableCollection { public init() { self.init(FilePath()) diff --git a/Sources/System/FilePath/FilePathComponents.swift b/Sources/System/FilePath/FilePathComponents.swift index 9be9aa8..7bb55d5 100644 --- a/Sources/System/FilePath/FilePathComponents.swift +++ b/Sources/System/FilePath/FilePathComponents.swift @@ -73,6 +73,7 @@ extension FilePath { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Component { /// Whether a component is a regular file or directory name, or a special @@ -253,7 +254,6 @@ extension FilePath.Root { // MARK: - Invariants -// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Component { // TODO: ensure this all gets easily optimized away in release... internal func _invariantCheck() { diff --git a/Sources/System/FilePath/FilePathParsing.swift b/Sources/System/FilePath/FilePathParsing.swift index 42905d1..e65833a 100644 --- a/Sources/System/FilePath/FilePathParsing.swift +++ b/Sources/System/FilePath/FilePathParsing.swift @@ -111,7 +111,6 @@ extension SystemString { } } -// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) extension FilePath { internal mutating func _removeTrailingSeparator() { _storage._removeTrailingSeparator() diff --git a/Sources/System/FilePath/FilePathString.swift b/Sources/System/FilePath/FilePathString.swift index eb9b27b..842367c 100644 --- a/Sources/System/FilePath/FilePathString.swift +++ b/Sources/System/FilePath/FilePathString.swift @@ -9,7 +9,7 @@ // MARK: - Platform string -// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Creates a file path by copying bytes from a null-terminated platform /// string. @@ -39,6 +39,7 @@ extension FilePath { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Component { /// Creates a file path component by copying bytes from a null-terminated /// platform string. @@ -75,6 +76,7 @@ extension FilePath.Component { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Root { /// Creates a file path root by copying bytes from a null-terminated platform /// string. @@ -234,6 +236,7 @@ extension FilePath.Root: CustomStringConvertible, CustomDebugStringConvertible { // MARK: - Convenience helpers // Convenience helpers +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Creates a string by interpreting the path’s content as UTF-8 on Unix /// and UTF-16 on Windows. @@ -244,6 +247,7 @@ extension FilePath { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Component { /// Creates a string by interpreting the component’s content as UTF-8 on Unix /// and UTF-16 on Windows. @@ -254,6 +258,7 @@ extension FilePath.Component { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Root { /// On Unix, this returns `"/"`. /// @@ -380,6 +385,7 @@ extension String { // MARK: - Deprecations +// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) extension String { @available(*, deprecated, renamed: "init(decoding:)") public init(_ path: FilePath) { self.init(decoding: path) } @@ -388,6 +394,7 @@ extension String { public init?(validatingUTF8 path: FilePath) { self.init(validating: path) } } +// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) extension FilePath { @available(*, deprecated, renamed: "init(platformString:)") public init(cString: UnsafePointer) { diff --git a/Sources/System/FilePath/FilePathSyntax.swift b/Sources/System/FilePath/FilePathSyntax.swift index fdd9782..ee02aa5 100644 --- a/Sources/System/FilePath/FilePathSyntax.swift +++ b/Sources/System/FilePath/FilePathSyntax.swift @@ -9,7 +9,7 @@ // MARK: - Query API -// @available(...) +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Returns true if this path uniquely identifies the location of /// a file without reference to an additional starting location. @@ -103,6 +103,7 @@ extension FilePath { } // MARK: - Decompose a path +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Returns the root of a path if there is one, otherwise `nil`. /// @@ -187,6 +188,7 @@ extension FilePath { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Returns the final component of the path. /// Returns `nil` if the path is empty or only contains a root. @@ -258,6 +260,7 @@ extension FilePath { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath.Component { /// The extension of this file or directory component. /// @@ -290,6 +293,7 @@ extension FilePath.Component { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// The extension of the file or directory last component. @@ -356,6 +360,7 @@ extension FilePath { } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Whether the path is in lexical-normal form, that is `.` and `..` /// components have been collapsed lexically (i.e. without following @@ -436,6 +441,7 @@ extension FilePath { } // Modification and concatenation API +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// If `prefix` is a prefix of `self`, removes it and returns `true`. /// Otherwise returns `false`. @@ -605,6 +611,7 @@ extension FilePath { } // MARK - Renamed +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { @available(*, unavailable, renamed: "removingLastComponent()") public var dirname: FilePath { removingLastComponent() } diff --git a/Sources/System/Platform/Platform.swift b/Sources/System/Platform/Platform.swift index 167bc61..069f90b 100644 --- a/Sources/System/Platform/Platform.swift +++ b/Sources/System/Platform/Platform.swift @@ -17,6 +17,7 @@ public typealias CModeT = CInterop.Mode /// A namespace for C and platform types +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) public enum CInterop { #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) /// The C `mode_t` type. diff --git a/Sources/System/Platform/PlatformString.swift b/Sources/System/Platform/PlatformString.swift index af1bee7..d68575f 100644 --- a/Sources/System/Platform/PlatformString.swift +++ b/Sources/System/Platform/PlatformString.swift @@ -7,6 +7,7 @@ See https://swift.org/LICENSE.txt for license information */ +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension CInterop { #if os(Windows) /// The platform's preferred character type. On Unix, this is an 8-bit C @@ -54,6 +55,7 @@ extension CInterop.PlatformUnicodeEncoding.CodeUnit { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension String { /// Creates a string by interpreting the null-terminated platform string as /// UTF-8 on Unix and UTF-16 on Windows. diff --git a/Tests/SystemTests/FilePathTests/FilePathComponentsTest.swift b/Tests/SystemTests/FilePathTests/FilePathComponentsTest.swift index 052fcc9..0979f95 100644 --- a/Tests/SystemTests/FilePathTests/FilePathComponentsTest.swift +++ b/Tests/SystemTests/FilePathTests/FilePathComponentsTest.swift @@ -15,7 +15,7 @@ import XCTest @testable import System #endif -// @available(9999....) +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) struct TestPathComponents: TestCase { var path: FilePath var expectedRoot: FilePath.Root? @@ -100,9 +100,7 @@ struct TestPathComponents: TestCase { } } -// TODO: Note that double-reversal will drop root if FilePath is constructed in between ... - -// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) final class FilePathComponentsTest: XCTestCase { func testAdHocRRC() { var path: FilePath = "/usr/local/bin" diff --git a/Tests/SystemTests/FilePathTests/FilePathExtras.swift b/Tests/SystemTests/FilePathTests/FilePathExtras.swift index 1fe790c..a9fa61a 100644 --- a/Tests/SystemTests/FilePathTests/FilePathExtras.swift +++ b/Tests/SystemTests/FilePathTests/FilePathExtras.swift @@ -6,6 +6,7 @@ #endif // Why can't I write this extension on `FilePath.ComponentView.SubSequence`? +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension Slice where Base == FilePath.ComponentView { internal var _storageSlice: SystemString.SubSequence { base._path._storage[self.startIndex._storage ..< self.endIndex._storage] @@ -14,6 +15,7 @@ extension Slice where Base == FilePath.ComponentView { // Proposed API that didn't make the cut, but we stil want to keep our testing for +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension FilePath { /// Returns `self` relative to `base`. /// This does not cosult the file system or resolve symlinks. diff --git a/Tests/SystemTests/FilePathTests/FilePathParsingTest.swift b/Tests/SystemTests/FilePathTests/FilePathParsingTest.swift index c268613..1636568 100644 --- a/Tests/SystemTests/FilePathTests/FilePathParsingTest.swift +++ b/Tests/SystemTests/FilePathTests/FilePathParsingTest.swift @@ -68,6 +68,7 @@ extension ParsingTestCase { @testable import System #endif +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) final class FilePathParsingTest: XCTestCase { func testNormalization() { let unixPaths: Array = [ diff --git a/Tests/SystemTests/FilePathTests/FilePathSyntaxTest.swift b/Tests/SystemTests/FilePathTests/FilePathSyntaxTest.swift index 403f5a0..cc931d4 100644 --- a/Tests/SystemTests/FilePathTests/FilePathSyntaxTest.swift +++ b/Tests/SystemTests/FilePathTests/FilePathSyntaxTest.swift @@ -146,6 +146,7 @@ extension SyntaxTestCase { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension SyntaxTestCase { func testComponents(_ path: FilePath, expected: [String]) { let expectedComponents = expected.map { FilePath.Component($0)! } @@ -341,6 +342,7 @@ private struct WindowsRootTestCase: TestCase { var line: UInt } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) extension WindowsRootTestCase { func runAllTests() { withWindowsPaths(enabled: true) { @@ -355,6 +357,7 @@ extension WindowsRootTestCase { } } +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) final class FilePathSyntaxTest: XCTestCase { func testPathSyntax() { let unixPaths: Array = [ diff --git a/Tests/SystemTests/FilePathTests/FilePathTest.swift b/Tests/SystemTests/FilePathTests/FilePathTest.swift index c667932..93bc350 100644 --- a/Tests/SystemTests/FilePathTests/FilePathTest.swift +++ b/Tests/SystemTests/FilePathTests/FilePathTest.swift @@ -27,7 +27,7 @@ func filePathFromUnterminatedBytes(_ bytes: S) -> FilePath where S. } let invalidBytes: [UInt8] = [0x2F, 0x61, 0x2F, 0x62, 0x2F, 0x83] -// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) final class FilePathTest: XCTestCase { struct TestPath { let filePath: FilePath diff --git a/Tests/SystemTests/MockingTest.swift b/Tests/SystemTests/MockingTest.swift index 87bee81..b377b09 100644 --- a/Tests/SystemTests/MockingTest.swift +++ b/Tests/SystemTests/MockingTest.swift @@ -17,7 +17,7 @@ import System @testable import SystemInternals -// @available... +// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) final class MockingTest: XCTestCase { func testMocking() { XCTAssertFalse(mockingEnabled)