mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
Merge pull request #200 from RobotsAndPencils/MakeSymLinkOnSelect
Add Preference to make Symbolic Link Automatic on Xcode Select
This commit is contained in:
commit
44bef1a5f4
2 changed files with 25 additions and 2 deletions
|
|
@ -68,7 +68,13 @@ class AppState: ObservableObject {
|
|||
Current.defaults.set(unxipExperiment, forKey: "unxipExperiment")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Published var createSymLinkOnSelect = false {
|
||||
didSet {
|
||||
Current.defaults.set(createSymLinkOnSelect, forKey: "createSymLinkOnSelect")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Publisher Cancellables
|
||||
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
|
|
@ -489,6 +495,10 @@ class AppState: ObservableObject {
|
|||
if case let .failure(error) = completion {
|
||||
self.error = error
|
||||
self.presentedAlert = .generic(title: "Unable to select Xcode", message: error.legibleLocalizedDescription)
|
||||
} else {
|
||||
if self.createSymLinkOnSelect {
|
||||
createSymbolicLink(xcode: xcode)
|
||||
}
|
||||
}
|
||||
self.selectPublisher = nil
|
||||
},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,20 @@ struct AdvancedPreferencePane: View {
|
|||
.font(.footnote)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
}
|
||||
.groupBoxStyle(PreferencesGroupBoxStyle())
|
||||
|
||||
GroupBox(label: Text("Active/Select")) {
|
||||
VStack(alignment: .leading) {
|
||||
Toggle(
|
||||
"Automatically create symbolic link to Xcodes.app",
|
||||
isOn: $appState.createSymLinkOnSelect
|
||||
)
|
||||
Text("When making an Xcode version Active/Selected, try and create a symbolic link named Xcode.app in the installation directory")
|
||||
.font(.footnote)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.groupBoxStyle(PreferencesGroupBoxStyle())
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue