Skip to content

Commit acc3eaa

Browse files
committed
Bug fixes
1 parent 9aef445 commit acc3eaa

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Sources/TSCBasic/Path.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ extension Path {
431431
private struct UNIXPath: Path {
432432
let string: String
433433

434+
#if os(Windows)
435+
static let root = UNIXPath(string: "\\")
436+
#else
434437
static let root = UNIXPath(string: "/")
438+
#endif
435439

436440
static func isValidComponent(_ name: String) -> Bool {
437441
#if os(Windows)
@@ -550,7 +554,7 @@ private struct UNIXPath: Path {
550554
var result: [WCHAR] = Array<WCHAR>(repeating: 0, count: Int(MAX_PATH + 1))
551555

552556
_ = path.standardizingPathSeparator().withCString(encodedAs: UTF16.self) {
553-
PathCchCanonicalize($0, result.length, $0)
557+
PathCchCanonicalize(&result, result.count, $0)
554558
}
555559
self.init(string: String(decodingCString: result, as: UTF16.self))
556560
#else

Sources/TSCBasic/PathShims.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public func resolveSymlinks(_ path: AbsolutePath) -> AbsolutePath {
2626
var resolved: URL = URL(fileURLWithPath: path.pathString)
2727
if let destination = try? FileManager.default.destinationOfSymbolicLink(atPath: path.pathString) {
2828
resolved = URL(fileURLWithPath: destination, relativeTo: URL(fileURLWithPath: path.pathString))
29+
} else {
30+
return try! AbsolutePath(validating: path.pathString)
2931
}
3032

3133
return resolved.standardized.withUnsafeFileSystemRepresentation {

0 commit comments

Comments
 (0)