Skip to content

Commit 2b11bb8

Browse files
committed
Address comments
1 parent c28a66d commit 2b11bb8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Sources/Swiftly/Unlink.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ struct Unlink: SwiftlyCommand {
3131
var pathChanged = false
3232
if let proxyTo = try? await Swiftly.currentPlatform.findSwiftlyBin(ctx) {
3333
let swiftlyBinDir = Swiftly.currentPlatform.swiftlyBinDir(ctx)
34-
let swiftlyBinDirContents = (try? FileManager.default.contentsOfDirectory(atPath: swiftlyBinDir.string)) ?? [String]()
34+
let swiftlyBinDirContents = (try? await fs.ls(atPath: swiftlyBinDir)) ?? [String]()
3535

36-
let existingProxies = swiftlyBinDirContents.filter { bin in
37-
do {
38-
let linkTarget = try FileManager.default.destinationOfSymbolicLink(atPath: (swiftlyBinDir / bin).string)
39-
return linkTarget == proxyTo.string
40-
} catch { return false }
36+
var existingProxies = [String]()
37+
for bin in swiftlyBinDirContents {
38+
let linkTarget = try? await fs.readlink(atPath: swiftlyBinDir / bin)
39+
if linkTarget == proxyTo {
40+
existingProxies.append(bin)
41+
}
4142
}
4243

4344
for p in existingProxies {

0 commit comments

Comments
 (0)