File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -55,26 +55,29 @@ internal extension String {
55
55
56
56
internal var _startOfPathExtension : String . Index ? {
57
57
precondition ( !hasSuffix( " / " ) )
58
-
59
- var curPos = endIndex
60
- let lastCompStartPos = _startOfLastPathComponent
61
-
58
+
59
+ var cursor = endIndex
60
+ let startOfLastPathComponent = _startOfLastPathComponent
61
+
62
62
// Find the beginning of the extension
63
- while curPos > lastCompStartPos {
64
- let prevPos = index ( before: curPos )
65
- let char = self [ prevPos ]
66
- if char == " / " {
63
+ while cursor > startOfLastPathComponent {
64
+ let previousPosition = index ( before: cursor )
65
+ let character = self [ previousPosition ]
66
+ if character == " / " {
67
67
return nil
68
- } else if char == " . " {
69
- if lastCompStartPos == prevPos {
68
+ } else if character == " . " {
69
+ if startOfLastPathComponent == previousPosition {
70
70
return nil
71
- } else if case let prevPrevPos = index ( before: prevPos) , prevPos == index ( before: endIndex) && prevPrevPos == lastCompStartPos && self [ prevPrevPos] == " . " {
71
+ } else if case let previous2Position = index ( before: previousPosition) ,
72
+ previousPosition == index ( before: endIndex) &&
73
+ previous2Position == startOfLastPathComponent && self [ previous2Position] == " . "
74
+ {
72
75
return nil
73
76
} else {
74
- return curPos
77
+ return cursor
75
78
}
76
79
}
77
- curPos = prevPos
80
+ cursor = previousPosition
78
81
}
79
82
return nil
80
83
}
You can’t perform that action at this time.
0 commit comments