Skip to content

Commit 28a5ce8

Browse files
authored
FoundationEssentials: repair the TimeZone implementation on Windows
Update the Windows path for `String.range(of:)` being altered to `String._range(of:anchored:backwards:)`. This repairs the build of FoundationEssentials on Windows.
1 parent db3d0a4 commit 28a5ce8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/FoundationEssentials/TimeZone/TimeZone_Cache.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ struct TimeZoneCache : Sendable {
154154
_ = GetFinalPathNameByHandleW(hFile, $0.baseAddress, dwSize, DWORD(VOLUME_NAME_DOS))
155155
return String(decodingCString: $0.baseAddress!, as: UTF16.self)
156156
}
157-
if let rangeOfZoneInfo = path.range(of: "\(TimeZone.TZDIR)\\") {
157+
if let rangeOfZoneInfo = path._range(of: "\(TimeZone.TZDIR)\\", anchored: false, backwards: false) {
158158
let name = path[rangeOfZoneInfo.upperBound...]
159159
if let result = fixed(String(name)) {
160-
return result
160+
return TimeZone(inner: result)
161161
}
162162
}
163163
#else

0 commit comments

Comments
 (0)