We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 31747eb + 20b4203 commit cf363a3Copy full SHA for cf363a3
Sources/TSCBasic/PathShims.swift
@@ -23,10 +23,13 @@ import Foundation
23
/// Returns the "real path" corresponding to `path` by resolving any symbolic links.
24
public func resolveSymlinks(_ path: AbsolutePath) -> AbsolutePath {
25
#if os(Windows)
26
- do {
27
- return try AbsolutePath(FileManager.default.destinationOfSymbolicLink(atPath: path.pathString).standardizingPath)
28
- } catch {
29
- return AbsolutePath(path.pathString.standardizingPath)
+ let resolved: String =
+ (try? FileManager.default.destinationOfSymbolicLink(atPath: path.pathString))
+ ?? path.pathString
+
30
+ return URL(fileURLWithPath: resolved.standardizingPath)
31
+ .withUnsafeFileSystemRepresentation {
32
+ try! AbsolutePath(validating: String(cString: $0!))
33
}
34
#else
35
let pathStr = path.pathString
0 commit comments