@@ -444,7 +444,8 @@ private struct UNIXPath: Path {
444
444
445
445
#if os(Windows)
446
446
static func isAbsolutePath( _ path: String ) -> Bool {
447
- return !path. prenormalized ( ) . withCString ( encodedAs: UTF16 . self, PathIsRelativeW)
447
+ return !path. standardizingPathSeparator ( )
448
+ . withCString ( encodedAs: UTF16 . self, PathIsRelativeW)
448
449
}
449
450
#endif
450
451
@@ -547,9 +548,8 @@ private struct UNIXPath: Path {
547
548
init ( normalizingAbsolutePath path: String ) {
548
549
#if os(Windows)
549
550
var result : [ WCHAR ] = Array < WCHAR > ( repeating: 0 , count: Int ( MAX_PATH + 1 ) )
550
- defer { LocalFree ( result) }
551
551
552
- _ = path. prenormalized ( ) . withCString ( encodedAs: UTF16 . self) {
552
+ _ = path. standardizingPathSeparator ( ) . withCString ( encodedAs: UTF16 . self) {
553
553
PathCchCanonicalize ( $0, result. length, $0)
554
554
}
555
555
self . init ( string: String ( decodingCString: result, as: UTF16 . self) )
@@ -620,7 +620,7 @@ private struct UNIXPath: Path {
620
620
let pathSeparator : Character
621
621
#if os(Windows)
622
622
pathSeparator = " \\ "
623
- let path = path. prenormalized ( )
623
+ let path = path. standardizingPathSeparator ( )
624
624
#else
625
625
pathSeparator = " / "
626
626
#endif
@@ -958,8 +958,8 @@ private func mayNeedNormalization(absolute string: String) -> Bool {
958
958
959
959
#if os(Windows)
960
960
fileprivate extension String {
961
- func prenormalized ( ) -> String {
961
+ func standardizingPathSeparator ( ) -> String {
962
962
return self . replacingOccurrences ( of: " / " , with: " \\ " )
963
963
}
964
964
}
965
- #endif
965
+ #endif
0 commit comments