Skip to content

Commit 9aef445

Browse files
committed
Minor fixes
1 parent a279f53 commit 9aef445

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/TSCBasic/Path.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ private struct UNIXPath: Path {
444444

445445
#if os(Windows)
446446
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)
448449
}
449450
#endif
450451

@@ -547,9 +548,8 @@ private struct UNIXPath: Path {
547548
init(normalizingAbsolutePath path: String) {
548549
#if os(Windows)
549550
var result: [WCHAR] = Array<WCHAR>(repeating: 0, count: Int(MAX_PATH + 1))
550-
defer { LocalFree(result) }
551551

552-
_ = path.prenormalized().withCString(encodedAs: UTF16.self) {
552+
_ = path.standardizingPathSeparator().withCString(encodedAs: UTF16.self) {
553553
PathCchCanonicalize($0, result.length, $0)
554554
}
555555
self.init(string: String(decodingCString: result, as: UTF16.self))
@@ -620,7 +620,7 @@ private struct UNIXPath: Path {
620620
let pathSeparator: Character
621621
#if os(Windows)
622622
pathSeparator = "\\"
623-
let path = path.prenormalized()
623+
let path = path.standardizingPathSeparator()
624624
#else
625625
pathSeparator = "/"
626626
#endif
@@ -958,8 +958,8 @@ private func mayNeedNormalization(absolute string: String) -> Bool {
958958

959959
#if os(Windows)
960960
fileprivate extension String {
961-
func prenormalized() -> String {
961+
func standardizingPathSeparator() -> String {
962962
return self.replacingOccurrences(of: "/", with: "\\")
963963
}
964964
}
965-
#endif
965+
#endif

0 commit comments

Comments
 (0)