File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,13 @@ import Foundation
23
23
/// Returns the "real path" corresponding to `path` by resolving any symbolic links.
24
24
public func resolveSymlinks( _ path: AbsolutePath ) -> AbsolutePath {
25
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)
26
+ let resolved : String =
27
+ ( try ? FileManager . default. destinationOfSymbolicLink ( atPath: path. pathString) )
28
+ ?? path. pathString
29
+
30
+ return URL ( fileURLWithPath: resolved. standardizingPath)
31
+ . withUnsafeFileSystemRepresentation {
32
+ try ! AbsolutePath ( validating: String ( cString: $0!) )
30
33
}
31
34
#else
32
35
let pathStr = path. pathString
You can’t perform that action at this time.
0 commit comments