-
Notifications
You must be signed in to change notification settings - Fork 55
Do not move symlink swiftly into the bin directory #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
f9f0b6e
3311e60
49b6a7c
a1f77a0
d570939
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,10 +373,21 @@ 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 { | ||
return | ||
} | ||
|
||
// Traverse a symbolic link to the real swiftly | ||
|
||
if let linkDest = try? FileManager.default.destinationOfSymbolicLink(atPath: cmdAbsolute) { | ||
if linkDest.isAbsolute { | ||
cmdAbsolute = linkDest | ||
} else { | ||
cmdAbsolute = (cmdAbsolute / linkDest.string).lexicallyNormalized() | ||
} | ||
} | ||
|
||
guard case let cmdAbsolute else { fatalError() } | ||
|
||
|
||
// Proceed to installation only if we're in the user home directory, or a non-system location. | ||
let userHome = fs.home | ||
|
||
|
There was a problem hiding this comment.
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