Skip to content

Commit 7ae956e

Browse files
committed
add Xcode-Beta.app Symlink and localizations
1 parent 78c9207 commit 7ae956e

17 files changed

Lines changed: 55 additions & 21 deletions

File tree

Xcodes/Backend/AppState.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,10 @@ class AppState: ObservableObject {
609609
NSPasteboard.general.setString(url.absoluteString, forType: .string)
610610
}
611611

612-
func createSymbolicLink(xcode: Xcode) {
612+
func createSymbolicLink(xcode: Xcode, isBeta: Bool = false) {
613613
guard let installedXcodePath = xcode.installedPath else { return }
614614

615-
let destinationPath: Path = Path.installDirectory/"Xcode.app"
615+
let destinationPath: Path = Path.installDirectory/"Xcode\(isBeta ? "-Beta" : "").app"
616616

617617
// does an Xcode.app file exist?
618618
if FileManager.default.fileExists(atPath: destinationPath.string) {
@@ -634,7 +634,7 @@ class AppState: ObservableObject {
634634

635635
do {
636636
try FileManager.default.createSymbolicLink(atPath: destinationPath.string, withDestinationPath: installedXcodePath.string)
637-
Logger.appState.info("Successfully created symbolic link with Xcode.app")
637+
Logger.appState.info("Successfully created symbolic link with Xcode\(isBeta ? "-Beta": "").app")
638638
} catch {
639639
Logger.appState.error("Unable to create symbolic Link")
640640
self.error = error

Xcodes/Backend/XcodeCommands.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,23 @@ struct CreateSymbolicLinkButton: View {
189189
}
190190
}
191191

192+
struct CreateSymbolicBetaLinkButton: View {
193+
@EnvironmentObject var appState: AppState
194+
let xcode: Xcode?
195+
196+
var body: some View {
197+
Button(action: createSymbolicBetaLink) {
198+
Text("CreateSymLinkBeta")
199+
}
200+
.help("CreateSymLinkBeta")
201+
}
202+
203+
private func createSymbolicBetaLink() {
204+
guard let xcode = xcode else { return }
205+
appState.createSymbolicLink(xcode: xcode, isBeta: true)
206+
}
207+
}
208+
192209
// MARK: - Commands
193210

194211
struct InstallCommand: View {

Xcodes/Frontend/XcodeList/XcodeListViewRow.swift

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ struct XcodeListViewRow: View {
66
let xcode: Xcode
77
let selected: Bool
88
let appState: AppState
9-
9+
1010
var body: some View {
1111
HStack {
1212
appIconView(for: xcode)
13-
13+
1414
VStack(alignment: .leading) {
1515
HStack {
1616
Text(verbatim: "\(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)")
1717
.font(.body)
18-
18+
1919
if !xcode.identicalBuilds.isEmpty {
2020
Image(systemName: "square.fill.on.square.fill")
2121
.font(.subheadline)
@@ -25,7 +25,7 @@ struct XcodeListViewRow: View {
2525
.help("IdenticalBuilds.help")
2626
}
2727
}
28-
28+
2929
if case let .installed(path) = xcode.installState {
3030
Text(verbatim: path.string)
3131
.font(.caption)
@@ -35,9 +35,9 @@ struct XcodeListViewRow: View {
3535
.font(.caption)
3636
}
3737
}
38-
38+
3939
Spacer()
40-
40+
4141
selectControl(for: xcode)
4242
.padding(.trailing, 16)
4343
installControl(for: xcode)
@@ -54,14 +54,17 @@ struct XcodeListViewRow: View {
5454
RevealButton(xcode: xcode)
5555
CopyPathButton(xcode: xcode)
5656
CreateSymbolicLinkButton(xcode: xcode)
57+
if xcode.version.isPrerelease {
58+
CreateSymbolicBetaLinkButton(xcode: xcode)
59+
}
5760
Divider()
5861
UninstallButton(xcode: xcode)
59-
62+
6063
#if DEBUG
61-
Divider()
62-
Button("Perform post-install steps") {
63-
appState.performPostInstallSteps(for: InstalledXcode(path: path)!) as Void
64-
}
64+
Divider()
65+
Button("Perform post-install steps") {
66+
appState.performPostInstallSteps(for: InstalledXcode(path: path)!) as Void
67+
}
6568
#endif
6669
}
6770
}
@@ -77,7 +80,7 @@ struct XcodeListViewRow: View {
7780
.foregroundColor(.secondary)
7881
}
7982
}
80-
83+
8184
@ViewBuilder
8285
private func selectControl(for xcode: Xcode) -> some View {
8386
if xcode.installState.installed {
@@ -97,7 +100,7 @@ struct XcodeListViewRow: View {
97100
EmptyView()
98101
}
99102
}
100-
103+
101104
@ViewBuilder
102105
private func installControl(for xcode: Xcode) -> some View {
103106
switch xcode.installState {
@@ -129,31 +132,31 @@ struct XcodeListViewRow_Previews: PreviewProvider {
129132
selected: false,
130133
appState: AppState()
131134
)
132-
135+
133136
XcodeListViewRow(
134137
xcode: Xcode(version: Version("12.2.0")!, installState: .notInstalled, selected: false, icon: nil),
135138
selected: false,
136139
appState: AppState()
137140
)
138-
141+
139142
XcodeListViewRow(
140143
xcode: Xcode(version: Version("12.1.0")!, installState: .installing(.downloading(progress: configure(Progress(totalUnitCount: 100)) { $0.completedUnitCount = 40 })), selected: false, icon: nil),
141144
selected: false,
142145
appState: AppState()
143146
)
144-
147+
145148
XcodeListViewRow(
146149
xcode: Xcode(version: Version("12.0.0")!, installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: false, icon: nil),
147150
selected: false,
148151
appState: AppState()
149152
)
150-
153+
151154
XcodeListViewRow(
152155
xcode: Xcode(version: Version("12.0.0+1234A")!, installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: false, icon: nil),
153156
selected: false,
154157
appState: AppState()
155158
)
156-
159+
157160
XcodeListViewRow(
158161
xcode: Xcode(version: Version("12.0.0+1234A")!, identicalBuilds: [Version("12.0.0-RC+1234A")!], installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: false, icon: nil),
159162
selected: false,

Xcodes/Resources/de.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"OpenDescription" = "Diese Version öffnen";
1717
"CopyPath" = "Pfad kopieren";
1818
"CreateSymLink" = "Symlink als Xcode.app erstellen";
19+
"CreateSymLinkBeta" = "Symlink als Xcode-Beta.app erstellen";
1920
"Uninstall" = "Deinstallieren";
2021
"Selected" = "Ausgewählt";
2122
"Select" = "Auswählen";

Xcodes/Resources/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"OpenDescription" = "Open this version";
1717
"CopyPath" = "Copy Path";
1818
"CreateSymLink" = "Create Symlink as Xcode.app";
19+
"CreateSymLinkBeta" = "Create Symlink as Xcode-Beta.app";
1920
"Uninstall" = "Uninstall";
2021
"Selected" = "Selected";
2122
"Select" = "Select";

Xcodes/Resources/es.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"OpenDescription" = "Abrir esta versión";
1717
"CopyPath" = "Copiar Ruta";
1818
"CreateSymLink" = "Crear Symlink como Xcode.app";
19+
"CreateSymLinkBeta" = "Crear Symlink como Xcode-Beta.app";
1920
"Uninstall" = "Desinstalar";
2021
"Selected" = "Seleccionado";
2122
"Select" = "Seleccionar";

Xcodes/Resources/fi.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"OpenDescription" = "Avaa tämä versio";
1717
"CopyPath" = "Kopioi polku";
1818
"CreateSymLink" = "Luo Symlink nimellä Xcode.app";
19+
"CreateSymLinkBeta" = "Luo Symlink nimellä Xcode-Beta.app";
1920
"Uninstall" = "Poista";
2021
"Selected" = "Valittu";
2122
"Select" = "Valitse";

Xcodes/Resources/fr.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"OpenDescription" = "Ouvrir cette version";
1818
"CopyPath" = "Copier le chemin d'accès";
1919
"CreateSymLink" = "Créer un Symlink pour Xcode.app";
20+
"CreateSymLink" = "Créer un Symlink pour Xcode-Beta.app";
2021
"Uninstall" = "Désinstaller";
2122
"Selected" = "Sélectionné";
2223
"Select" = "Sélectionner";

Xcodes/Resources/hi.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"OpenDescription" = "इस संस्करण को खोलें";
1717
"CopyPath" = "पथ की कॉपी करे";
1818
"CreateSymLink" = "Xcode.app के रूप में सिमलिंक बनाएं";
19+
"CreateSymLinkBeta" = "Xcode-Beta.app के रूप में सिमलिंक बनाएं";
1920
"Uninstall" = "असंस्थापित करे";
2021
"Selected" = "चयनित";
2122
"Select" = "चयन करे";

Xcodes/Resources/it.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"OpenDescription" = "Apri questa versione";
1717
"CopyPath" = "Copia Percorso";
1818
"CreateSymLink" = "Crea Symlink come Xcode.app";
19+
"CreateSymLinkBeta" = "Crea Symlink come Xcode-Beta.app";
1920
"Uninstall" = "Disinstalla";
2021
"Selected" = "Selezionato";
2122
"Select" = "Seleziona";

0 commit comments

Comments
 (0)