@@ -30,9 +30,9 @@ extension FilePath {
3030 /// * `\\?\Volume{12345678-abcd-1111-2222-123445789abc}\`
3131 public struct Root {
3232 internal var _path : FilePath
33- internal var _rootEnd : SystemString . Index
33+ internal var _rootEnd : _SystemString . Index
3434
35- internal init ( _ path: FilePath , rootEnd: SystemString . Index ) {
35+ internal init ( _ path: FilePath , rootEnd: _SystemString . Index ) {
3636 self . _path = path
3737 self . _rootEnd = rootEnd
3838 _invariantCheck ( )
@@ -56,14 +56,14 @@ extension FilePath {
5656 /// path.append(file) // path is "/tmp/foo.txt"
5757 public struct Component {
5858 internal var _path : FilePath
59- internal var _range : Range < SystemString . Index >
59+ public var _range : Range < _SystemString . Index >
6060
6161 // TODO: Make a small-component form to save on ARC overhead when
6262 // extracted from a path, and especially to save on allocation overhead
6363 // when constructing one from a String literal.
6464
6565 internal init < RE: RangeExpression > ( _ path: FilePath , _ range: RE )
66- where RE. Bound == SystemString . Index {
66+ where RE. Bound == _SystemString . Index {
6767 self . _path = path
6868 self . _range = range. relative ( to: path. _storage)
6969 precondition ( !self . _range. isEmpty, " FilePath components cannot be empty " )
@@ -104,7 +104,7 @@ extension FilePath.Root {
104104
105105// MARK: - Internals
106106
107- extension SystemString {
107+ extension _SystemString {
108108 // TODO: take insertLeadingSlash: Bool
109109 // TODO: turn into an insert operation with slide
110110 internal mutating func appendComponents< C: Collection > (
@@ -126,22 +126,22 @@ extension SystemString {
126126}
127127
128128// Unifying protocol for common functionality between roots, components,
129- // and views onto SystemString and FilePath.
130- internal protocol _StrSlice : _PlatformStringable , Hashable , Codable {
131- var _storage : SystemString { get }
132- var _range : Range < SystemString . Index > { get }
129+ // and views onto_SystemString and FilePath.
130+ public protocol _StrSlice : _PlatformStringable , Hashable , Codable {
131+ var _storage : _SystemString { get }
132+ var _range : Range < _SystemString . Index > { get }
133133
134- init ? ( _ str: SystemString )
134+ init ? ( _ str: _SystemString )
135135
136136 func _invariantCheck( )
137137}
138138extension _StrSlice {
139- internal var _slice : Slice < SystemString > {
139+ internal var _slice : Slice < _SystemString > {
140140 Slice ( base: _storage, bounds: _range)
141141 }
142142
143143 internal func _withSystemChars< T> (
144- _ f: ( UnsafeBufferPointer < SystemChar > ) throws -> T
144+ _ f: ( UnsafeBufferPointer < _SystemChar > ) throws -> T
145145 ) rethrows -> T {
146146 try _storage. withSystemChars {
147147 try f ( UnsafeBufferPointer ( rebasing: $0 [ _range] ) )
@@ -153,17 +153,17 @@ extension _StrSlice {
153153 try _slice. withCodeUnits ( f)
154154 }
155155
156- internal init ? ( _platformString s: UnsafePointer < CInterop . PlatformChar > ) {
157- self . init ( SystemString ( platformString: s) )
156+ public init ? ( _platformString s: UnsafePointer < CInterop . PlatformChar > ) {
157+ self . init ( _SystemString ( platformString: s) )
158158 }
159159
160- internal func _withPlatformString< Result> (
160+ public func _withPlatformString< Result> (
161161 _ body: ( UnsafePointer < CInterop . PlatformChar > ) throws -> Result
162162 ) rethrows -> Result {
163163 try _slice. withPlatformString ( body)
164164 }
165165
166- internal var _systemString : SystemString { SystemString ( _slice) }
166+ internal var _systemString : _SystemString { _SystemString ( _slice) }
167167}
168168extension _StrSlice {
169169 public static func == ( lhs: Self , rhs: Self ) -> Bool {
@@ -180,35 +180,35 @@ internal protocol _PathSlice: _StrSlice {
180180 var _path : FilePath { get }
181181}
182182extension _PathSlice {
183- internal var _storage : SystemString { _path. _storage }
183+ public var _storage : _SystemString { _path. _storage }
184184}
185185
186186@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
187187extension FilePath . Component : _PathSlice {
188188}
189189@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
190190extension FilePath . Root : _PathSlice {
191- internal var _range : Range < SystemString . Index > {
191+ public var _range : Range < _SystemString . Index > {
192192 ( ..< _rootEnd) . relative ( to: _path. _storage)
193193 }
194194}
195195
196196@available ( /*System 0.0.1: macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0*/iOS 8 , * )
197197extension FilePath : _PlatformStringable {
198- func _withPlatformString< Result> ( _ body: ( UnsafePointer < CInterop . PlatformChar > ) throws -> Result ) rethrows -> Result {
198+ public func _withPlatformString< Result> ( _ body: ( UnsafePointer < CInterop . PlatformChar > ) throws -> Result ) rethrows -> Result {
199199 try _storage. withPlatformString ( body)
200200 }
201201
202- init ( _platformString: UnsafePointer < CInterop . PlatformChar > ) {
203- self . init ( SystemString ( platformString: _platformString) )
202+ public init ( _platformString: UnsafePointer < CInterop . PlatformChar > ) {
203+ self . init ( _SystemString ( platformString: _platformString) )
204204 }
205205
206206}
207207
208208@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
209209extension FilePath . Component {
210210 // The index of the `.` denoting an extension
211- internal func _extensionIndex( ) -> SystemString . Index ? {
211+ internal func _extensionIndex( ) -> _SystemString . Index ? {
212212 guard kind == . regular,
213213 let idx = _slice. lastIndex ( of: . dot) ,
214214 idx != _slice. startIndex
@@ -217,26 +217,26 @@ extension FilePath.Component {
217217 return idx
218218 }
219219
220- internal func _extensionRange( ) -> Range < SystemString . Index > ? {
220+ internal func _extensionRange( ) -> Range < _SystemString . Index > ? {
221221 guard let idx = _extensionIndex ( ) else { return nil }
222222 return _slice. index ( after: idx) ..< _slice. endIndex
223223 }
224224
225- internal func _stemRange( ) -> Range < SystemString . Index > {
225+ internal func _stemRange( ) -> Range < _SystemString . Index > {
226226 _slice. startIndex ..< ( _extensionIndex ( ) ?? _slice. endIndex)
227227 }
228228}
229229
230- internal func _makeExtension( _ ext: String ) -> SystemString {
231- var result = SystemString ( )
230+ internal func _makeExtension( _ ext: String ) -> _SystemString {
231+ var result = _SystemString ( )
232232 result. append ( . dot)
233- result. append ( contentsOf: ext. unicodeScalars. lazy. map ( SystemChar . init) )
233+ result. append ( contentsOf: ext. unicodeScalars. lazy. map ( _SystemChar . init) )
234234 return result
235235}
236236
237237@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
238238extension FilePath . Component {
239- internal init ? ( _ str: SystemString ) {
239+ public init ? ( _ str: _SystemString ) {
240240 // FIXME: explicit null root? Or something else?
241241 let path = FilePath ( str)
242242 guard path. root == nil , path. components. count == 1 else {
@@ -249,7 +249,7 @@ extension FilePath.Component {
249249
250250@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
251251extension FilePath . Root {
252- internal init ? ( _ str: SystemString ) {
252+ public init ? ( _ str: _SystemString ) {
253253 // FIXME: explicit null root? Or something else?
254254 let path = FilePath ( str)
255255 guard path. root != nil , path. components. isEmpty else {
@@ -265,7 +265,7 @@ extension FilePath.Root {
265265@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
266266extension FilePath . Component {
267267 // TODO: ensure this all gets easily optimized away in release...
268- internal func _invariantCheck( ) {
268+ public func _invariantCheck( ) {
269269 #if DEBUG
270270 precondition ( !_slice. isEmpty)
271271 precondition ( _slice. last != . null)
@@ -277,7 +277,7 @@ extension FilePath.Component {
277277
278278@available ( /*System 0.0.2: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0*/iOS 8 , * )
279279extension FilePath . Root {
280- internal func _invariantCheck( ) {
280+ public func _invariantCheck( ) {
281281 #if DEBUG
282282 precondition ( self . _rootEnd > _path. _storage. startIndex)
283283
0 commit comments