Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Sources/SwiftlyCore/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,17 @@ extension Platform {

// We couldn't find ourselves in the usual places. Assume that no installation is necessary
// since we were most likely invoked at SWIFTLY_BIN_DIR already.
guard let cmdAbsolute else {
guard var cmdAbsolute else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is must simpler now; this can be changed back to let and the guard case let cmdAbsolute = cmdAbsolute else { fatalError() } can be removed completely

return
}

// If swiftly is symlinked then we leave it where it is, such as in a homebrew installation.
if let _ = try? FileManager.default.destinationOfSymbolicLink(atPath: cmdAbsolute) {
return
}

guard case let cmdAbsolute = cmdAbsolute else { fatalError() }

// Proceed to installation only if we're in the user home directory, or a non-system location.
let userHome = fs.home

Expand Down