diff --git a/.gitignore b/.gitignore index 18d371b..c32cb51 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ Product/* timeline.xctimeline playground.xcworkspace +# Jetbrains IDEA +.idea + # Swift Package Manager # # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. diff --git a/Xcodes/Backend/AppState.swift b/Xcodes/Backend/AppState.swift index bf25352..39c57a8 100644 --- a/Xcodes/Backend/AppState.swift +++ b/Xcodes/Backend/AppState.swift @@ -610,10 +610,10 @@ class AppState: ObservableObject { NSPasteboard.general.setString(url.absoluteString, forType: .string) } - func createSymbolicLink(xcode: Xcode) { + func createSymbolicLink(xcode: Xcode, isBeta: Bool = false) { guard let installedXcodePath = xcode.installedPath else { return } - let destinationPath: Path = Path.installDirectory/"Xcode.app" + let destinationPath: Path = Path.installDirectory/"Xcode\(isBeta ? "-Beta" : "").app" // does an Xcode.app file exist? if FileManager.default.fileExists(atPath: destinationPath.string) { @@ -635,7 +635,7 @@ class AppState: ObservableObject { do { try FileManager.default.createSymbolicLink(atPath: destinationPath.string, withDestinationPath: installedXcodePath.string) - Logger.appState.info("Successfully created symbolic link with Xcode.app") + Logger.appState.info("Successfully created symbolic link with Xcode\(isBeta ? "-Beta": "").app") } catch { Logger.appState.error("Unable to create symbolic Link") self.error = error diff --git a/Xcodes/Backend/XcodeCommands.swift b/Xcodes/Backend/XcodeCommands.swift index 3120c0f..b02cf60 100644 --- a/Xcodes/Backend/XcodeCommands.swift +++ b/Xcodes/Backend/XcodeCommands.swift @@ -189,6 +189,23 @@ struct CreateSymbolicLinkButton: View { } } +struct CreateSymbolicBetaLinkButton: View { + @EnvironmentObject var appState: AppState + let xcode: Xcode? + + var body: some View { + Button(action: createSymbolicBetaLink) { + Text("CreateSymLinkBeta") + } + .help("CreateSymLinkBeta") + } + + private func createSymbolicBetaLink() { + guard let xcode = xcode else { return } + appState.createSymbolicLink(xcode: xcode, isBeta: true) + } +} + // MARK: - Commands struct InstallCommand: View { diff --git a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift index 10f3cfb..555c361 100644 --- a/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift +++ b/Xcodes/Frontend/XcodeList/XcodeListViewRow.swift @@ -6,16 +6,16 @@ struct XcodeListViewRow: View { let xcode: Xcode let selected: Bool let appState: AppState - + var body: some View { HStack { appIconView(for: xcode) - + VStack(alignment: .leading) { HStack { Text(verbatim: "\(xcode.description) \(xcode.version.buildMetadataIdentifiersDisplay)") .font(.body) - + if !xcode.identicalBuilds.isEmpty { Image(systemName: "square.fill.on.square.fill") .font(.subheadline) @@ -25,7 +25,7 @@ struct XcodeListViewRow: View { .help("IdenticalBuilds.help") } } - + if case let .installed(path) = xcode.installState { Text(verbatim: path.string) .font(.caption) @@ -35,9 +35,9 @@ struct XcodeListViewRow: View { .font(.caption) } } - + Spacer() - + selectControl(for: xcode) .padding(.trailing, 16) installControl(for: xcode) @@ -54,14 +54,17 @@ struct XcodeListViewRow: View { RevealButton(xcode: xcode) CopyPathButton(xcode: xcode) CreateSymbolicLinkButton(xcode: xcode) + if xcode.version.isPrerelease { + CreateSymbolicBetaLinkButton(xcode: xcode) + } Divider() UninstallButton(xcode: xcode) - + #if DEBUG - Divider() - Button("Perform post-install steps") { - appState.performPostInstallSteps(for: InstalledXcode(path: path)!) as Void - } + Divider() + Button("Perform post-install steps") { + appState.performPostInstallSteps(for: InstalledXcode(path: path)!) as Void + } #endif } } @@ -77,7 +80,7 @@ struct XcodeListViewRow: View { .foregroundColor(.secondary) } } - + @ViewBuilder private func selectControl(for xcode: Xcode) -> some View { if xcode.installState.installed { @@ -97,7 +100,7 @@ struct XcodeListViewRow: View { EmptyView() } } - + @ViewBuilder private func installControl(for xcode: Xcode) -> some View { switch xcode.installState { @@ -129,31 +132,31 @@ struct XcodeListViewRow_Previews: PreviewProvider { selected: false, appState: AppState() ) - + XcodeListViewRow( xcode: Xcode(version: Version("12.2.0")!, installState: .notInstalled, selected: false, icon: nil), selected: false, appState: AppState() ) - + XcodeListViewRow( xcode: Xcode(version: Version("12.1.0")!, installState: .installing(.downloading(progress: configure(Progress(totalUnitCount: 100)) { $0.completedUnitCount = 40 })), selected: false, icon: nil), selected: false, appState: AppState() ) - + XcodeListViewRow( xcode: Xcode(version: Version("12.0.0")!, installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: false, icon: nil), selected: false, appState: AppState() ) - + XcodeListViewRow( xcode: Xcode(version: Version("12.0.0+1234A")!, installState: .installed(Path("/Applications/Xcode-12.3.0.app")!), selected: false, icon: nil), selected: false, appState: AppState() ) - + XcodeListViewRow( 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), selected: false, diff --git a/Xcodes/Resources/de.lproj/Localizable.strings b/Xcodes/Resources/de.lproj/Localizable.strings index 2c1ab08..e40d7cc 100644 --- a/Xcodes/Resources/de.lproj/Localizable.strings +++ b/Xcodes/Resources/de.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Diese Version öffnen"; "CopyPath" = "Pfad kopieren"; "CreateSymLink" = "Symlink als Xcode.app erstellen"; +"CreateSymLinkBeta" = "Symlink als Xcode-Beta.app erstellen"; "Uninstall" = "Deinstallieren"; "Selected" = "Ausgewählt"; "Select" = "Auswählen"; diff --git a/Xcodes/Resources/en.lproj/Localizable.strings b/Xcodes/Resources/en.lproj/Localizable.strings index 56d4534..a4a685d 100644 --- a/Xcodes/Resources/en.lproj/Localizable.strings +++ b/Xcodes/Resources/en.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Open this version"; "CopyPath" = "Copy Path"; "CreateSymLink" = "Create Symlink as Xcode.app"; +"CreateSymLinkBeta" = "Create Symlink as Xcode-Beta.app"; "Uninstall" = "Uninstall"; "Selected" = "Selected"; "Select" = "Select"; diff --git a/Xcodes/Resources/es.lproj/Localizable.strings b/Xcodes/Resources/es.lproj/Localizable.strings index eec9ea6..3fca001 100644 --- a/Xcodes/Resources/es.lproj/Localizable.strings +++ b/Xcodes/Resources/es.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Abrir esta versión"; "CopyPath" = "Copiar Ruta"; "CreateSymLink" = "Crear Symlink como Xcode.app"; +"CreateSymLinkBeta" = "Crear Symlink como Xcode-Beta.app"; "Uninstall" = "Desinstalar"; "Selected" = "Seleccionado"; "Select" = "Seleccionar"; diff --git a/Xcodes/Resources/fi.lproj/Localizable.strings b/Xcodes/Resources/fi.lproj/Localizable.strings index 3d638b6..905a1e0 100644 --- a/Xcodes/Resources/fi.lproj/Localizable.strings +++ b/Xcodes/Resources/fi.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Avaa tämä versio"; "CopyPath" = "Kopioi polku"; "CreateSymLink" = "Luo Symlink nimellä Xcode.app"; +"CreateSymLinkBeta" = "Luo Symlink nimellä Xcode-Beta.app"; "Uninstall" = "Poista"; "Selected" = "Valittu"; "Select" = "Valitse"; diff --git a/Xcodes/Resources/fr.lproj/Localizable.strings b/Xcodes/Resources/fr.lproj/Localizable.strings index cfff5ca..0e619ef 100644 --- a/Xcodes/Resources/fr.lproj/Localizable.strings +++ b/Xcodes/Resources/fr.lproj/Localizable.strings @@ -17,6 +17,7 @@ "OpenDescription" = "Ouvrir cette version"; "CopyPath" = "Copier le chemin d'accès"; "CreateSymLink" = "Créer un Symlink pour Xcode.app"; +"CreateSymLink" = "Créer un Symlink pour Xcode-Beta.app"; "Uninstall" = "Désinstaller"; "Selected" = "Sélectionné"; "Select" = "Sélectionner"; diff --git a/Xcodes/Resources/hi.lproj/Localizable.strings b/Xcodes/Resources/hi.lproj/Localizable.strings index 069ccb4..22a672d 100644 --- a/Xcodes/Resources/hi.lproj/Localizable.strings +++ b/Xcodes/Resources/hi.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "इस संस्करण को खोलें"; "CopyPath" = "पथ की कॉपी करे"; "CreateSymLink" = "Xcode.app के रूप में सिमलिंक बनाएं"; +"CreateSymLinkBeta" = "Xcode-Beta.app के रूप में सिमलिंक बनाएं"; "Uninstall" = "असंस्थापित करे"; "Selected" = "चयनित"; "Select" = "चयन करे"; diff --git a/Xcodes/Resources/it.lproj/Localizable.strings b/Xcodes/Resources/it.lproj/Localizable.strings index 038c841..e8af7a2 100644 --- a/Xcodes/Resources/it.lproj/Localizable.strings +++ b/Xcodes/Resources/it.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Apri questa versione"; "CopyPath" = "Copia Percorso"; "CreateSymLink" = "Crea Symlink come Xcode.app"; +"CreateSymLinkBeta" = "Crea Symlink come Xcode-Beta.app"; "Uninstall" = "Disinstalla"; "Selected" = "Selezionato"; "Select" = "Seleziona"; diff --git a/Xcodes/Resources/ja.lproj/Localizable.strings b/Xcodes/Resources/ja.lproj/Localizable.strings index 999f954..33cb1c9 100644 --- a/Xcodes/Resources/ja.lproj/Localizable.strings +++ b/Xcodes/Resources/ja.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "このバージョンを開く"; "CopyPath" = "パスをコピー"; "CreateSymLink" = "Xcode.appとしてシンボリックリンクを作成"; +"CreateSymLinkBeta" = "Xcode-Beta.appとしてシンボリックリンクを作成"; "Uninstall" = "アンインストール"; "Selected" = "アクティブ"; "Select" = "アクティブにする"; diff --git a/Xcodes/Resources/ko.lproj/Localizable.strings b/Xcodes/Resources/ko.lproj/Localizable.strings index 26e5dda..24e0b6d 100644 --- a/Xcodes/Resources/ko.lproj/Localizable.strings +++ b/Xcodes/Resources/ko.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "이 버전 열기"; "CopyPath" = "경로 복사하기"; "CreateSymLink" = "Xcode.app과 같은 Symlink 만들기"; +"CreateSymLinkBeta" = "Xcode-Beta.app과 같은 Symlink 만들기"; "Uninstall" = "제거"; "Selected" = "선택됨"; "Select" = "선택"; diff --git a/Xcodes/Resources/ru.lproj/Localizable.strings b/Xcodes/Resources/ru.lproj/Localizable.strings index 1eb4549..e785967 100644 --- a/Xcodes/Resources/ru.lproj/Localizable.strings +++ b/Xcodes/Resources/ru.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Открыть эту версию"; "CopyPath" = "Копировать путь"; "CreateSymLink" = "Создать символическую ссылку к Xcode.app"; +"CreateSymLinkBeta" = "Создать символическую ссылку к Xcode-Beta.app"; "Uninstall" = "Удалить"; "Selected" = "Выбрано"; "Select" = "Выбрать"; diff --git a/Xcodes/Resources/tr.lproj/Localizable.strings b/Xcodes/Resources/tr.lproj/Localizable.strings index 6d52594..fd192fd 100644 --- a/Xcodes/Resources/tr.lproj/Localizable.strings +++ b/Xcodes/Resources/tr.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Bu sürümü aç"; "CopyPath" = "Yolu Kopyala"; "CreateSymLink" = "Xcode.app olarak sembolik link yarat"; +"CreateSymLinkBeta" = "Xcode-Beta.app olarak sembolik link yarat"; "Uninstall" = "Kaldır"; "Selected" = "Seçili"; "Select" = "Seç"; diff --git a/Xcodes/Resources/uk.lproj/Localizable.strings b/Xcodes/Resources/uk.lproj/Localizable.strings index 4f3a5c7..8dd8df7 100644 --- a/Xcodes/Resources/uk.lproj/Localizable.strings +++ b/Xcodes/Resources/uk.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "Запустити цю версію"; "CopyPath" = "Скопіювати шлях"; "CreateSymLink" = "Створити символічну ссилку як Xcode.app"; +"CreateSymLinkBeta" = "Створити символічну ссилку як Xcode-Beta.app"; "Uninstall" = "Видалити"; "Selected" = "Обрано"; "Select" = "Обрати"; diff --git a/Xcodes/Resources/zh-Hans.lproj/Localizable.strings b/Xcodes/Resources/zh-Hans.lproj/Localizable.strings index 3706bce..c18bb9d 100644 --- a/Xcodes/Resources/zh-Hans.lproj/Localizable.strings +++ b/Xcodes/Resources/zh-Hans.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "打开此版本"; "CopyPath" = "复制文件位置"; "CreateSymLink" = "以Xcode.app创建软链接"; +"CreateSymLinkBeta" = "以Xcode-Beta.app创建软链接"; "Uninstall" = "卸载"; "Selected" = "已选定"; "Select" = "选定"; diff --git a/Xcodes/Resources/zh-Hant.lproj/Localizable.strings b/Xcodes/Resources/zh-Hant.lproj/Localizable.strings index 1c770fe..3f16514 100644 --- a/Xcodes/Resources/zh-Hant.lproj/Localizable.strings +++ b/Xcodes/Resources/zh-Hant.lproj/Localizable.strings @@ -16,6 +16,7 @@ "OpenDescription" = "打開這個版本"; "CopyPath" = "拷貝路徑"; "CreateSymLink" = "製作 Xcode.app 的 Symlink"; +"CreateSymLink" = "製作 Xcode-Beta.app 的 Symlink"; "Uninstall" = "解除安裝"; "Selected" = "已選取"; "Select" = "選取";