File tree Expand file tree Collapse file tree 3 files changed +3
-8
lines changed
Tests/SystemTests/FilePathTests Expand file tree Collapse file tree 3 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -94,9 +94,6 @@ extension FilePath.Component {
9494 if _path. _isParentDirectory ( _range) { return . parentDirectory }
9595 return . regular
9696 }
97-
98- /// Whether this component is either special directory `.` or `..`.
99- public var isSpecialDirectory : Bool { _path. _isSpecialDirectory ( _range) }
10097}
10198
10299extension FilePath . Root {
@@ -207,7 +204,7 @@ extension FilePath: _PlatformStringable {
207204extension FilePath . Component {
208205 // The index of the `.` denoting an extension
209206 internal func _extensionIndex( ) -> SystemString . Index ? {
210- guard !isSpecialDirectory ,
207+ guard kind == . regular ,
211208 let idx = _slice. lastIndex ( of: . dot) ,
212209 idx != _slice. startIndex
213210 else { return nil }
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ extension FilePath {
325325 get { lastComponent? . extension }
326326 set {
327327 defer { _invariantCheck ( ) }
328- guard let base = lastComponent, ! base. isSpecialDirectory else { return }
328+ guard let base = lastComponent, base. kind == . regular else { return }
329329
330330 let suffix : SystemString
331331 if let ext = newValue {
@@ -373,7 +373,7 @@ extension FilePath {
373373 // `\..\foo\bar` should not.
374374 components. drop (
375375 while: { root == nil && $0. kind == . parentDirectory }
376- ) . allSatisfy { ! $0. isSpecialDirectory }
376+ ) . allSatisfy { $0. kind == . regular }
377377 }
378378
379379 /// Collapse `.` and `..` components lexically (i.e. without following
Original file line number Diff line number Diff line change @@ -916,14 +916,12 @@ final class FilePathSyntaxTest: XCTestCase {
916916 path. append ( " . " )
917917 expect ( " /. " )
918918 XCTAssert ( path. components. last!. kind == . currentDirectory)
919- XCTAssert ( path. components. last!. isSpecialDirectory)
920919 path. lexicallyNormalize ( )
921920 expect ( " / " )
922921
923922 path. append ( " .. " )
924923 expect ( " /.. " )
925924 XCTAssert ( path. components. last!. kind == . parentDirectory)
926- XCTAssert ( path. components. last!. isSpecialDirectory)
927925 path. lexicallyNormalize ( )
928926 expect ( " / " )
929927
You can’t perform that action at this time.
0 commit comments