Skip to content

Commit 1bba4b3

Browse files
compnerdaciidgh
authored andcommitted
Basic: replace symlink with Foundation
Use `createSymbolicLink` from Foundation rather than using `symlink` from the C library which is not portable (Windows does not provide `symlink`).
1 parent 22a397b commit 1bba4b3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Sources/Basic/PathShims.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public func makeDirectories(_ path: AbsolutePath) throws {
4545
/// be a relative path, otherwise it will be absolute.
4646
public func createSymlink(_ path: AbsolutePath, pointingAt dest: AbsolutePath, relative: Bool = true) throws {
4747
let destString = relative ? dest.relative(to: path.parentDirectory).pathString : dest.pathString
48-
let rv = SPMLibc.symlink(destString, path.pathString)
49-
guard rv == 0 else { throw SystemError.symlink(errno, path.pathString, dest: destString) }
48+
try FileManager.default.createSymbolicLink(atPath: path.pathString, withDestinationPath: destString)
5049
}
5150

5251
/// The current working directory of the processs.

0 commit comments

Comments
 (0)