From 9613c285dd40095c47772ee4e47494c06618d57a Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 28 Oct 2026 12:25:41 -0400 Subject: [PATCH 1/5] Release 0.9.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31648fa2..ddb710b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,7 +272,7 @@ checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" [[package]] name = "artcraft-launcher" -version = "0.8.1" +version = "0.9.0" dependencies = [ "artcraft-launcher-core", "artcraft-launcher-native", @@ -298,7 +298,7 @@ dependencies = [ [[package]] name = "artcraft-launcher-core" -version = "0.8.1" +version = "0.9.0" dependencies = [ "jiff", "semver", @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "artcraft-launcher-native" -version = "0.8.1" +version = "0.9.0" dependencies = [ "artcraft-launcher-core", "craft-update", @@ -332,7 +332,7 @@ dependencies = [ [[package]] name = "artcraft-launcher-ui-egui" -version = "0.8.1" +version = "0.9.0" dependencies = [ "artcraft-launcher-core", "craft-ui", @@ -352,7 +352,7 @@ dependencies = [ [[package]] name = "artcraft-launcher-web" -version = "0.8.1" +version = "0.9.0" dependencies = [ "artcraft-launcher-core", "artcraft-launcher-ui-egui", @@ -6228,7 +6228,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "xtask" -version = "0.8.1" +version = "0.9.0" dependencies = [ "jiff", "semver", diff --git a/Cargo.toml b/Cargo.toml index fc0edc0c..31fff0cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*", "apps/*", "xtask"] [workspace.package] -version = "0.8.1" +version = "0.9.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 157f605d6ca65d4e7c2e702162c32f62e53ec624 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 28 Oct 2026 18:08:07 +0000 Subject: [PATCH 2/5] fix(installer): Open fails with "X isn't where it was installed (X)" on MSI installs (#954) * fix(installer): open an MSI app whose exe is outside its record's scope; never show a bare name as its location * style: rustfmt the bare-name launch message * fix(installer): keep the launch fallback out of the MSI update folder; show the bare-name message only for Windows MSI installs * fix(installer): look for the exe in the folder the package recorded, in any hive, before guessing default folders * fix(installer): open the fallback copy whose version is the selected record's * fix(installer): compare the recorded exe to the stored location with one shared spelling * fix(installer): let a version match see every root's copy, not only the first --- crates/native/src/detect.rs | 151 ++++++++++++++++++++++++++++++++--- crates/native/src/install.rs | 37 +++++++++ 2 files changed, 176 insertions(+), 12 deletions(-) diff --git a/crates/native/src/detect.rs b/crates/native/src/detect.rs index c62ded9d..3f83b944 100644 --- a/crates/native/src/detect.rs +++ b/crates/native/src/detect.rs @@ -256,6 +256,19 @@ pub mod windows { crate::msi_context::single_scope(scopes) } + /// How an exe path is stored in `Installed::location`. One function builds it for `detect` and for + /// the comparison below, so the two can never disagree on spelling. + fn location_text(exe: &std::path::Path) -> String { + exe.display().to_string() + } + + /// Whether `location` is the exe the record `product_code` resolves in its own scope. False for + /// a path that only the launch fallback (`exe_in_any_scope`) found, so an update never takes its + /// folder from another scope. + pub fn location_is_in_record_scope(app: &CraftApp, product_code: &str, location: &str) -> bool { + msi_installs(app).into_iter().find(|m| m.product_code == product_code).and_then(|m| m.exe).is_some_and(|exe| location_text(&exe) == location) + } + /// Every Windows Installer entry for `app`, newest first. pub fn msi_installs(app: &CraftApp) -> Vec { let mut out = Vec::new(); @@ -332,23 +345,74 @@ pub mod windows { } roots }; - let launcher_folders = suite_folders(app, &roots); - if let Some(found) = launcher_folders.iter().find_map(|dir| exe_candidates(app, Some(dir), &[]).into_iter().find(|p| p.exists())) { - return Some(found); + exe_in_roots(app, roots) + } + + /// Where the exe may be under the given install roots, best first: the launcher's own folder, then + /// the `ArtCraft` suite folder of each root, then the bare roots (older installs). Not checked on + /// disk. + fn candidates_in_roots(app: &CraftApp, roots: &[PathBuf]) -> Vec { + let mut out: Vec = suite_folders(app, roots).iter().flat_map(|dir| exe_candidates(app, Some(dir), &[])).collect(); + let mut dirs: Vec = roots.iter().map(|root| root.join("ArtCraft")).collect(); + dirs.extend(roots.iter().cloned()); + out.extend(exe_candidates(app, None, &dirs)); + out + } + + /// The first exe under the given install roots. + pub(super) fn exe_in_roots(app: &CraftApp, roots: Vec) -> Option { + candidates_in_roots(app, &roots).into_iter().find(|p| p.exists()) + } + + /// Every exe under the given install roots, in the order `exe_in_roots` prefers them. + pub(super) fn exe_all_in_roots(app: &CraftApp, roots: Vec) -> Vec { + candidates_in_roots(app, &roots).into_iter().filter(|p| p.exists()).collect() + } + + /// The app's exe directly in `folder`, under any name it has shipped as. + pub(super) fn exe_in_folder(app: &CraftApp, folder: &std::path::Path) -> Option { + exe_candidates(app, Some(folder), &[]).into_iter().find(|p| p.exists()) + } + + /// Last resort for opening an app whose uninstall record names no folder and whose exe is not in + /// the record's own scope. The package records its folder (`InstallDir`) in the hive of the account + /// that installed it, which need not be the hive of its uninstall record: a per-user install can + /// leave a per-machine record. So the folder any hive or view recorded is tried first (this finds + /// a custom folder), then the usual folders of every scope. This only decides which exe "Open" + /// runs and where "Show in folder" goes. An update never takes its folder from here + /// (`location_is_in_record_scope`), and the record's scope is unchanged. Every candidate is + /// collected and the one whose own version is the record's is chosen, so a leftover older copy in + /// another scope is not opened under the newer record's version (`pick_candidate`). + fn exe_in_any_scope(app: &CraftApp, version: Option<&version::Version>) -> Option { + let mut found: Vec = + UNINSTALL_ROOTS.into_iter().filter_map(|(hive, flags)| exe_in_folder(app, &install_dir(app, hive, flags)?)).collect(); + let mut roots: Vec = std::env::var_os("LOCALAPPDATA").map(|local| PathBuf::from(local).join("Programs")).into_iter().collect(); + for var in ["ProgramW6432", "ProgramFiles", "ProgramFiles(x86)"] { + if let Some(pf) = std::env::var_os(var).map(PathBuf::from) + && !roots.contains(&pf) + { + roots.push(pf); + } } - let mut candidates: Vec = roots.iter().map(|root| root.join("ArtCraft")).collect(); - candidates.extend(roots); - exe_candidates(app, None, &candidates).into_iter().find(|p| p.exists()) + found.extend(exe_all_in_roots(app, roots)); + pick_candidate(found, version, executable_version) + } + + /// The first candidate whose version is `wanted`; with no match (or no version to match, or exes + /// without version info) the first candidate, in the order they were found. + pub(super) fn pick_candidate( + candidates: Vec, + wanted: Option<&version::Version>, + version_of: impl Fn(&std::path::Path) -> Option, + ) -> Option { + let matching = wanted.and_then(|want| candidates.iter().find(|c| version_of(c).as_ref() == Some(want))); + matching.or_else(|| candidates.first()).cloned() } pub fn detect(app: &CraftApp) -> Option { let m = msi_installs(app).into_iter().next()?; - Some(Installed { - version: m.version, - source: InstallSource::Msi, - location: m.exe.map_or_else(|| app.name.to_string(), |p| p.display().to_string()), - package: Some(m.product_code), - }) + let location = m.exe.or_else(|| exe_in_any_scope(app, m.version.as_ref())).map_or_else(|| app.name.to_string(), |p| location_text(&p)); + Some(Installed { version: m.version, source: InstallSource::Msi, location, package: Some(m.product_code) }) } } @@ -846,6 +910,69 @@ mod tests { } } + /// An app unpacked into the suite folder of a root is found from that root alone, so "Open" works + /// for a record whose folder is not the one its scope would name. + #[cfg(windows)] + #[test] + fn an_exe_in_the_suite_folder_of_any_root_is_found() { + let dir = tempfile::tempdir().unwrap(); + let deck = CraftApp::by_id("deckcraft").unwrap(); + let folder = dir.path().join("ArtCraft").join("DeckCraft"); + std::fs::create_dir_all(&folder).unwrap(); + std::fs::write(folder.join("deckcraft.exe"), "x").unwrap(); + assert_eq!(windows::exe_in_roots(deck, vec![dir.path().to_path_buf()]), Some(folder.join("deckcraft.exe"))); + assert_eq!(windows::exe_in_roots(deck, vec![dir.path().join("elsewhere")]), None); + } + + /// A folder the package recorded is searched as it is, whatever it is called, so an app installed + /// to a folder of the user's choosing is found. + #[cfg(windows)] + #[test] + fn an_exe_in_a_custom_recorded_folder_is_found() { + let dir = tempfile::tempdir().unwrap(); + let deck = CraftApp::by_id("deckcraft").unwrap(); + let custom = dir.path().join("My Slides"); + std::fs::create_dir_all(&custom).unwrap(); + assert_eq!(windows::exe_in_folder(deck, &custom), None); + std::fs::write(custom.join("deckcraft.exe"), "x").unwrap(); + assert_eq!(windows::exe_in_folder(deck, &custom), Some(custom.join("deckcraft.exe"))); + } + + /// With two copies in different scopes, the one that is the record's version is chosen, wherever it + /// was found; with no match, the first found. + #[cfg(windows)] + #[test] + fn the_copy_with_the_records_version_is_the_one_opened() { + let v = |s: &str| version::parse(s); + let old = PathBuf::from(r"D:\Old\deckcraft.exe"); + let new = PathBuf::from(r"C:\Users\a\AppData\Local\Programs\ArtCraft\DeckCraft\deckcraft.exe"); + let version_of = |p: &std::path::Path| if p == old { v("0.11.1") } else { v("0.12.0") }; + let both = vec![old.clone(), new.clone()]; + assert_eq!(windows::pick_candidate(both.clone(), v("0.12.0").as_ref(), version_of), Some(new.clone())); + assert_eq!(windows::pick_candidate(both.clone(), v("0.11.1").as_ref(), version_of), Some(old.clone())); + assert_eq!(windows::pick_candidate(both.clone(), v("0.99.0").as_ref(), version_of), Some(old.clone())); + assert_eq!(windows::pick_candidate(both, None, version_of), Some(old.clone())); + assert_eq!(windows::pick_candidate(Vec::new(), v("0.12.0").as_ref(), version_of), None); + } + + /// Every exe under the given roots, in the order `exe_in_roots` prefers them, so a version match + /// can see a copy that an earlier root's older copy would otherwise hide. + #[cfg(windows)] + #[test] + fn every_root_is_searched_for_a_version_match() { + let dir = tempfile::tempdir().unwrap(); + let deck = CraftApp::by_id("deckcraft").unwrap(); + let (a, b) = (dir.path().join("a"), dir.path().join("b")); + let exes: Vec = [&a, &b].iter().map(|r| r.join("ArtCraft").join("DeckCraft").join("deckcraft.exe")).collect(); + for exe in &exes { + std::fs::create_dir_all(exe.parent().unwrap()).unwrap(); + std::fs::write(exe, "x").unwrap(); + } + assert_eq!(windows::exe_all_in_roots(deck, vec![a.clone(), b.clone()]), exes); + assert_eq!(windows::exe_in_roots(deck, vec![a, b]), exes.first().cloned()); + assert!(windows::exe_all_in_roots(deck, vec![dir.path().join("none")]).is_empty()); + } + #[test] fn the_launcher_msi_installs_to_artcraft_launcher_and_the_apps_do_not() { let roots = roots(); diff --git a/crates/native/src/install.rs b/crates/native/src/install.rs index 4713b004..acf2054a 100644 --- a/crates/native/src/install.rs +++ b/crates/native/src/install.rs @@ -77,6 +77,8 @@ pub fn install_at( let _ = commit; #[allow(unused_variables)] let destination = destination(app, kind, existing, previous, job.install_locations)?; + #[cfg(windows)] + let destination = msi_update_folder(app, kind, existing, destination); if let Some(inst) = existing && inst.source.launcher_can_update() && process::is_running(Path::new(&inst.location)) @@ -233,6 +235,25 @@ pub fn occupied( Ok(target.filter(|t| std::fs::symlink_metadata(t).is_ok())) } +/// An MSI update keeps the folder of the copy it replaces only when that copy was found in the +/// record's own scope. A path found by the launch-only fallback, in another scope, is never passed +/// to the installer: the update then keeps the record's context and the package's own folder. +#[cfg(windows)] +fn msi_update_folder(app: &CraftApp, kind: PackageKind, existing: Option<&Installed>, destination: Option) -> Option { + match existing { + Some(inst) if kind == PackageKind::Msi && inst.source == InstallSource::Msi => { + let in_scope = inst.package.as_deref().is_some_and(|code| crate::detect::windows::location_is_in_record_scope(app, code, &inst.location)); + keep_if_in_scope(destination, in_scope) + } + _ => destination, + } +} + +#[cfg(windows)] +fn keep_if_in_scope(destination: Option, in_scope: bool) -> Option { + destination.filter(|_| in_scope) +} + /// The folder a new copy goes in: beside the launcher's copy it replaces, else the user's choice, /// else the platform default (`None`). macOS updates find their bundle's folder themselves. fn destination( @@ -628,6 +649,12 @@ pub fn launch(app: &CraftApp, installed: &Installed, paths: &Paths) -> Result<() _ if cfg!(target_os = "macos") && path.extension().is_some_and(|e| e == "app") => process::open(path.as_os_str()), _ => { if !path.exists() { + if cfg!(windows) && installed.source == InstallSource::Msi && path.components().count() < 2 { + return Err(format!( + "{} is registered with Windows, but the launcher can't find where it put the program. Reinstall it from here.", + app.name + )); + } return Err(format!("{} isn't where it was installed ({})", app.name, path.display())); } process::launch_binary(path, &[]) @@ -1821,6 +1848,16 @@ pub mod windows { mod tests { use super::*; + /// A folder found only by the launch fallback, in another scope, never reaches the installer. + #[cfg(windows)] + #[test] + fn an_update_takes_the_folder_only_from_the_records_own_scope() { + let folder = Some(PathBuf::from(r"C:\Users\a\AppData\Local\Programs\ArtCraft\DeckCraft")); + assert_eq!(keep_if_in_scope(folder.clone(), true), folder); + assert_eq!(keep_if_in_scope(folder, false), None); + assert_eq!(keep_if_in_scope(None, true), None); + } + #[cfg(unix)] #[test] fn msi_install_uses_the_package_target_instead_of_a_symlinked_cache() { From deccd0ac1e83313c4e433f49bdfff3b42ba9a716 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 15:35:30 -0400 Subject: [PATCH 3/5] Honor CARGO_BUILD_TARGET in FreeBSD packaging for aarch64 release builds (#958) --- packaging/freebsd/package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.sh index 6eafb129..114edc78 100755 --- a/packaging/freebsd/package.sh +++ b/packaging/freebsd/package.sh @@ -57,7 +57,7 @@ echo "==> ArtCraft Launcher $VERSION for FreeBSD $ARCH" export CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-4}" if [[ "$SKIP_BUILD" = 0 ]]; then - (cd "$ROOT" && cargo build --release --locked -p "$PKG") + (cd "$ROOT" && cargo build --release --locked -p "$PKG" ${CARGO_BUILD_TARGET:+--target "$CARGO_BUILD_TARGET"}) fi WORK="$CARGO_TARGET_DIR/freebsd-package" STAGE="$WORK/$BASENAME" From 46761082e6065a290cabb860986b10a452505414 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 18:51:51 -0400 Subject: [PATCH 4/5] feat: add SolidCraft as a community app (Official / Community badges) (#963) * feat: add SolidCraft as a community app, with Official and Community badges Add AppKind (Official | Community) to the catalog and a bundle id override, since SolidCraft's Flatpak and desktop id is io.tangencylabs.solidcraft. The grid card shows the kind as a badge, and the table has a Type column. Strings are translated in the seven complete catalogs. Community apps are not under storytold/. AGENTS.md reserves that decision for a maintainer; this PR needs that approval before it merges. * details: add the SolidCraft page and fix its attribution licence The page has no screenshots yet: the pictures repository has none for SolidCraft. ATTRIBUTION.md now records the MIT OR Apache-2.0 licence that SolidCraft's README gives. * fix: pass fmt, clippy, tests and wasm for the SolidCraft change - Show each app's publisher as a lowercase byline ("by ArtCraft", "by Tangency Labs") in place of the Official and Community words, with a publisher field on CraftApp. - Translate the byline, the By column and the SolidCraft tagline in every complete catalog. - Format the catalog and details tables with rustfmt, and fix two needless borrows. * fix: address review comments; Author column and shorter SolidCraft tagline - Detect SolidCraft's MSI by its own publisher ("SolidCraft contributors"), recorded per app as CraftApp::msi_publisher. - Look up missing Flatpak versions for every catalog bundle id, not only ai.storyteller.*. - Keep SolidCraft's MIT and Apache-2.0 license texts next to its icon. - Table: an Author column (plain text) after Released, before the buttons. - SolidCraft's tagline is "Parametric 3D CAD": the card's byline names Tangency Labs. * detect: find SolidCraft's Flatpak under its older ids SolidCraft's Flatpak shipped as ai.storyteller.solvecraft, then ai.storyteller.solidcraft, before io.tangencylabs.solidcraft. Add CraftApp::former_bundles and bundle_ids() (current first), match them in the Flatpak list and the version lookup, and open and remove a Flatpak under the id it was found under. * fix: address CodeRabbit review (removal, Flatpak migration, macOS, website) - Remove a deb/rpm/pacman install by the package name detection found, not the app id. - After a Flatpak update from one of an app's older ids, uninstall the old copy (keeping its ~/.var/app data, which SolidCraft's first launch copies its settings from), so it doesn't reappear once the new one is removed. - macOS: don't install SolidCraft from its macOS build, which carries no Developer ID signature to check (CraftApp::installs_on_mac); the Developer ID check for official apps is unchanged. A copy that's there is still detected and opened, under its current or a former bundle id. - SolidCraft's Website link goes to solidcraft.io (CraftApp::site). * docs(AGENTS): allow tangency-labs/solidcraft as an approved community app Downloads come from storytold//releases or, for an approved community app, its own repo: today only tangency-labs/solidcraft, approved by the project owner on 2026-10-28. Its repo is pinned in the catalog; the release feed can't move an app out of storytold/. Community apps get the same SHA256SUMS check, and macOS installs still need a verifiable Developer ID. The rule that agents never land or approve another third-party app is unchanged. --- AGENTS.md | 19 +- ATTRIBUTION.md | 1 + README.md | 3 +- .../app-icons/LICENSE-APACHE-SolidCraft.txt | 177 ++++++++++++++++++ assets/app-icons/LICENSE-MIT-SolidCraft.txt | 21 +++ assets/app-icons/solidcraft.png | Bin 0 -> 9607 bytes crates/core/src/catalog.rs | 109 +++++++++-- crates/core/src/details.rs | 20 +- crates/native/src/detect.rs | 32 +++- crates/native/src/install.rs | 72 ++++++- crates/native/src/packages.rs | 14 +- crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-BR.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/zh-CN.tsv | 3 + crates/ui-egui/src/model.rs | 3 +- crates/ui-egui/src/views.rs | 20 +- 23 files changed, 484 insertions(+), 37 deletions(-) create mode 100644 assets/app-icons/LICENSE-APACHE-SolidCraft.txt create mode 100644 assets/app-icons/LICENSE-MIT-SolidCraft.txt create mode 100644 assets/app-icons/solidcraft.png diff --git a/AGENTS.md b/AGENTS.md index e1d78929..71c32217 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,8 @@ ArtCraft Launcher installs, updates and launches the **Craft App Suite** (PhotoCraft, LightCraft, FilmCraft, DesignCraft, VectorCraft, PdfCraft, EffectCraft, WordCraft, DeckCraft, GridCraft, -CADCraft, SoundCraft, FigCraft). It is written in **Rust only** (no JavaScript or TypeScript): the desktop +CADCraft, SoundCraft, FigCraft), plus approved **community apps** made outside ArtCraft and labelled +as such (today SolidCraft, by Tangency Labs). It is written in **Rust only** (no JavaScript or TypeScript): the desktop app is native egui/eframe, and the web build is the same Rust compiled to WebAssembly (trunk + wasm-bindgen). **No Tauri, Electron or webview shells**, ever. @@ -57,19 +58,27 @@ settings file must produce an error the user can act on, never a panic. Shared s ### Installing other people's software safely -- Download only from `https://github.com/storytold//releases` (and GitHub's asset CDN). - The one exception is a developer's own loopback mirror (`ARTCRAFT_LAUNCHER_DOWNLOAD_BASE`, +- Download only from `https://github.com/storytold//releases` (and GitHub's asset CDN), or + from an approved community app's own repo: today only + `https://github.com/tangency-labs/solidcraft/releases` (SolidCraft, approved by the project + owner on 2026-10-28). A community app's repo is pinned in the catalog (`CraftApp::repo`, + `AppKind::Community`): the release feed can move an app within `storytold/`, never to another + owner. The one other exception is a developer's own loopback mirror (`ARTCRAFT_LAUNCHER_DOWNLOAD_BASE`, `cargo xtask local`); keep it loopback-only and behind the `local-mirror` cargo feature, which release builds never enable. - Verify each download against the release's `SHA256SUMS.txt` before running or installing it. + Community apps get the same check. On macOS the launcher also requires a Developer ID signature + it can verify: an app without one (SolidCraft today, `installs_on_mac = false`) is not installed + there, only opened if present. - The details drawer's pictures are the one other download: JPEGs only, from a pinned tag of `https://raw.githubusercontent.com/storytold/craft-launcher-assets/` (`core::details`), capped at 2 MB each, cached, and never run. Pictures are not bundled in this repo. - Never run an installer with elevated rights silently; tell the user what is about to happen. - Never delete a user's files outside what the launcher itself installed. - **Agents never land or approve a third-party app.** A change that adds a catalog row, download - source or install path for an app whose repo is not under `storytold/`, or that loosens the - rules above to allow one, is a maintainer's call alone. An agent reviewing it flags it at the + source or install path for an app whose repo is not under `storytold/` and isn't one of the + approved community apps above, or that loosens the rules above to allow one, is a maintainer's + call alone. An agent reviewing it flags it at the top of its review (who owns the repo, its age and history, whether the builds are signed) and stops there: no merge, no approval, no fixes pushed to the PR. diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 6de02307..f0ee4ae1 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -47,6 +47,7 @@ licensed like those apps. Refresh them from the source path, never redraw them. | `assets/app-icons/deckcraft.png` | DeckCraft app icon (placeholder icon (presentation board)), 128 px | ArtCraft Team and the DeckCraft contributors | [`storytold/deckcraft`](https://github.com/storytold/deckcraft) `assets/app-icon/hicolor/128x128/apps/ai.storyteller.deckcraft.png`, copied unmodified | MIT OR Apache-2.0 (DeckCraft's [`LICENSE-MIT`](https://github.com/storytold/deckcraft/blob/main/LICENSE-MIT), [`LICENSE-APACHE`](https://github.com/storytold/deckcraft/blob/main/LICENSE-APACHE)) | | `assets/app-icons/gridcraft.png` | GridCraft app icon (app icon), 128 px | ArtCraft Team and the GridCraft contributors | [`storytold/gridcraft`](https://github.com/storytold/gridcraft) `assets/app-icon/hicolor/128x128/apps/ai.storyteller.gridcraft.png`, copied unmodified | MIT OR Apache-2.0 (GridCraft's [`LICENSE-MIT`](https://github.com/storytold/gridcraft/blob/main/LICENSE-MIT), [`LICENSE-APACHE`](https://github.com/storytold/gridcraft/blob/main/LICENSE-APACHE)) | | `assets/app-icons/cadcraft.png` | CADCraft app icon (app icon), 128 px | ArtCraft Team and the CADCraft contributors | [`storytold/cadcraft`](https://github.com/storytold/cadcraft) `assets/app-icon/hicolor/128x128/apps/ai.storyteller.cadcraft.png`, copied unmodified | MIT OR Apache-2.0 (CADCraft's [`LICENSE-MIT`](https://github.com/storytold/cadcraft/blob/main/LICENSE-MIT), [`LICENSE-APACHE`](https://github.com/storytold/cadcraft/blob/main/LICENSE-APACHE)) | +| `assets/app-icons/solidcraft.png` | SolidCraft app icon (app icon), 128 px | Tangency Labs and the SolidCraft contributors | [`tangency-labs/solidcraft`](https://github.com/tangency-labs/solidcraft) `assets/icons/app/linux/exports/hicolor/128x128/apps/io.tangencylabs.solidcraft.png`, copied unmodified | MIT OR Apache-2.0, [`assets/app-icons/LICENSE-MIT-SolidCraft.txt`](assets/app-icons/LICENSE-MIT-SolidCraft.txt), [`assets/app-icons/LICENSE-APACHE-SolidCraft.txt`](assets/app-icons/LICENSE-APACHE-SolidCraft.txt) | | `assets/app-icons/soundcraft.png` | SoundCraft app icon (nightingale (placeholder)), 128 px | ArtCraft Team and the SoundCraft contributors | [`storytold/soundcraft`](https://github.com/storytold/soundcraft) `assets/app-icon/hicolor/128x128/apps/ai.storyteller.soundcraft.png`, copied unmodified | MIT OR Apache-2.0 (SoundCraft's [`LICENSE-MIT`](https://github.com/storytold/soundcraft/blob/main/LICENSE-MIT), [`LICENSE-APACHE`](https://github.com/storytold/soundcraft/blob/main/LICENSE-APACHE)) | | `assets/app-icons/figcraft.png` | FigCraft app icon (chameleon), 128 px | ArtCraft Team and the FigCraft contributors | [`storytold/figcraft`](https://github.com/storytold/figcraft) `assets/app-icon/hicolor/128x128/apps/ai.storyteller.figcraft.png`, copied unmodified | MIT OR Apache-2.0 (FigCraft's [`LICENSE-MIT`](https://github.com/storytold/figcraft/blob/main/LICENSE-MIT), [`LICENSE-APACHE`](https://github.com/storytold/figcraft/blob/main/LICENSE-APACHE)) | diff --git a/README.md b/README.md index 809af403..f73c51ae 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@

One place to install, update and open every app in the Craft App Suite, rebuilt in pure Rust.
PhotoCraft, LightCraft, FilmCraft, DesignCraft, VectorCraft, PdfCraft, EffectCraft, WordCraft,
- DeckCraft, GridCraft, CADCraft, SoundCraft and FigCraft: the right build for your computer, kept up to date. + DeckCraft, GridCraft, CADCraft, SoundCraft, FigCraft and the community app SolidCraft: the right build for your computer, kept up to date.

@@ -272,6 +272,7 @@ stand on its own. | | **DeckCraft** | Presentations and slide decks | [GitHub](https://github.com/storytold/deckcraft) | [Website](https://getartcraft.com/apps/deckcraft) | | | **CADCraft** | Computer-aided design | [GitHub](https://github.com/storytold/cadcraft) | [Website](https://getartcraft.com/apps/cadcraft) | | | **GridCraft** | Spreadsheets and data | [GitHub](https://github.com/storytold/gridcraft) | [Website](https://getartcraft.com/apps/gridcraft) | +| | **SolidCraft** | Parametric 3D CAD by Tangency Labs (community app) | [GitHub](https://github.com/tangency-labs/solidcraft) | | And [**ArtCraft**](https://getartcraft.com/) itself, our AI image and video studio for artists who want real control. diff --git a/assets/app-icons/LICENSE-APACHE-SolidCraft.txt b/assets/app-icons/LICENSE-APACHE-SolidCraft.txt new file mode 100644 index 00000000..f433b1a5 --- /dev/null +++ b/assets/app-icons/LICENSE-APACHE-SolidCraft.txt @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/assets/app-icons/LICENSE-MIT-SolidCraft.txt b/assets/app-icons/LICENSE-MIT-SolidCraft.txt new file mode 100644 index 00000000..bd0e0f26 --- /dev/null +++ b/assets/app-icons/LICENSE-MIT-SolidCraft.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 SolidCraft contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/assets/app-icons/solidcraft.png b/assets/app-icons/solidcraft.png new file mode 100644 index 0000000000000000000000000000000000000000..1963e0f8e3c9043778178dfed6b942acbab548cf GIT binary patch literal 9607 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, + /// The bundle id when it isn't `ai.storyteller.` (a community app brings its own). + pub bundle: Option<&'static str>, + /// Older bundle ids its Flatpak shipped under (SolidCraft was `ai.storyteller.solidcraft`). + pub former_bundles: &'static [&'static str], + /// Its website, when it isn't a page on getartcraft.com (a community app has its own). + pub site: Option<&'static str>, + /// Whether the launcher installs its macOS build. `false` while those builds carry no + /// Developer ID signature the launcher can check: it then opens a copy that's there and + /// links to the releases, but installs nothing. + pub installs_on_mac: bool, } impl CraftApp { /// `ai.storyteller.`: macOS bundle id, Flatpak id and Linux desktop-file id. pub fn bundle_id(&self) -> String { - format!("ai.storyteller.{}", self.id) + self.bundle.map_or_else(|| format!("ai.storyteller.{}", self.id), str::to_string) } pub fn releases_url(&self) -> String { @@ -42,9 +65,19 @@ impl CraftApp { format!("https://github.com/{}", self.repo) } - /// The app's page on getartcraft.com. + /// The app's website: its page on getartcraft.com, or a community app's own site. pub fn website(&self) -> String { - format!("https://getartcraft.com/apps/{}", self.id) + self.site.map_or_else(|| format!("https://getartcraft.com/apps/{}", self.id), str::to_string) + } + + /// Whether the launcher installs this app from a `kind` package. + pub fn installs(&self, kind: crate::PackageKind) -> bool { + kind != crate::PackageKind::Dmg || self.installs_on_mac + } + + /// Bundle ids this app may be installed under, current first. + pub fn bundle_ids(&self) -> impl Iterator + '_ { + std::iter::once(self.bundle_id()).chain(self.former_bundles.iter().map(|b| b.to_string())) } /// Asset stems this app's releases may use, current first. @@ -69,11 +102,28 @@ const fn app( [color, ink_light, ink_dark]: [[u8; 3]; 3], repo: &'static str, ) -> CraftApp { - CraftApp { id, name, tagline, color, ink_light, ink_dark, repo, former_ids: &[], former_names: &[] } + CraftApp { + id, + name, + tagline, + color, + ink_light, + ink_dark, + repo, + former_ids: &[], + former_names: &[], + kind: AppKind::Official, + publisher: "ArtCraft", + msi_publisher: None, + bundle: None, + former_bundles: &[], + site: None, + installs_on_mac: true, + } } -/// The Craft App Suite, in display order matching getartcraft.com: -pub const SUITE: [CraftApp; 13] = [ +/// The Craft App Suite, in display order matching getartcraft.com, then the community apps: +pub const SUITE: [CraftApp; 14] = [ app("photocraft", "PhotoCraft", "Image editing", [[0x2f, 0x7b, 0xf5], [0x1a, 0x5b, 0xc4], [0x7f, 0xb0, 0xff]], "storytold/photocraft"), app("vectorcraft", "VectorCraft", "Vector illustration", [[0xe8, 0x57, 0x3f], [0xb8, 0x3a, 0x24], [0xff, 0x8a, 0x70]], "storytold/vectorcraft"), app( @@ -145,12 +195,29 @@ pub const SUITE: [CraftApp; 13] = [ "storytold/cadcraft", ), app("gridcraft", "GridCraft", "Spreadsheets and data", [[0x1f, 0x9d, 0x55], [0x12, 0x70, 0x3a], [0x4f, 0xd6, 0x8a]], "storytold/gridcraft"), + CraftApp { + kind: AppKind::Community, + publisher: "Tangency Labs", + msi_publisher: Some("SolidCraft contributors"), + bundle: Some("io.tangencylabs.solidcraft"), + former_bundles: &["ai.storyteller.solidcraft", "ai.storyteller.solvecraft"], + site: Some("https://solidcraft.io"), + // Its macOS builds aren't Developer ID signed yet (its README says to right-click Open). + installs_on_mac: false, + ..app( + "solidcraft", + "SolidCraft", + "Parametric 3D CAD", + [[0x46, 0xa1, 0xfb], [0x16, 0x53, 0xae], [0x8c, 0xc4, 0xff]], + "tangency-labs/solidcraft", + ) + }, ]; /// ArtCraft's website. pub const WEBSITE_URL: &str = "https://getartcraft.com"; -/// The GitHub account every Craft App's repository lives under: the only one the launcher -/// installs from, whatever the release feed says. +/// The GitHub account every official Craft App's repository lives under. The release feed can +/// only move an app within it; a community app installs from its own repo, pinned in [`SUITE`]. pub const GITHUB_OWNER: &str = "storytold"; /// ArtCraft on GitHub: every Craft App's source. pub const GITHUB_URL: &str = "https://github.com/storytold"; @@ -198,6 +265,7 @@ pub fn app_icon_png(id: &str) -> Option<&'static [u8]> { "wordcraft" => include_bytes!("../../../assets/app-icons/wordcraft.png"), "deckcraft" => include_bytes!("../../../assets/app-icons/deckcraft.png"), "gridcraft" => include_bytes!("../../../assets/app-icons/gridcraft.png"), + "solidcraft" => include_bytes!("../../../assets/app-icons/solidcraft.png"), "cadcraft" => include_bytes!("../../../assets/app-icons/cadcraft.png"), "soundcraft" => include_bytes!("../../../assets/app-icons/soundcraft.png"), "figcraft" => include_bytes!("../../../assets/app-icons/figcraft.png"), @@ -219,18 +287,35 @@ mod tests { } #[test] - fn suite_has_thirteen_apps_with_unique_ids() { - assert_eq!(SUITE.len(), 13); + fn suite_has_fourteen_apps_with_unique_ids() { + assert_eq!(SUITE.len(), 14); let mut ids: Vec<_> = SUITE.iter().map(|a| a.id).collect(); ids.sort_unstable(); ids.dedup(); assert_eq!(ids.len(), SUITE.len()); for a in &SUITE { - assert_eq!(a.repo, format!("storytold/{}", a.id)); assert_eq!(a.name.to_lowercase(), a.id); + match a.kind { + AppKind::Official => assert_eq!(a.repo, format!("storytold/{}", a.id)), + AppKind::Community => assert!(!a.repo.starts_with("storytold/"), "{} is community", a.id), + } } } + #[test] + fn solidcraft_is_a_community_app_with_its_own_bundle_id() { + let sc = CraftApp::by_id("solidcraft").unwrap(); + assert_eq!(sc.kind, AppKind::Community); + assert_eq!(sc.repo, "tangency-labs/solidcraft"); + assert_eq!(sc.bundle_id(), "io.tangencylabs.solidcraft"); + assert_eq!(sc.bundle_ids().collect::>(), ["io.tangencylabs.solidcraft", "ai.storyteller.solidcraft", "ai.storyteller.solvecraft"]); + assert_eq!(CraftApp::by_id("gridcraft").unwrap().bundle_id(), "ai.storyteller.gridcraft"); + assert_eq!(CraftApp::by_id("gridcraft").unwrap().kind, AppKind::Official); + assert_eq!(sc.website(), "https://solidcraft.io"); + assert!(!sc.installs(crate::PackageKind::Dmg) && sc.installs(crate::PackageKind::Msi) && sc.installs(crate::PackageKind::Flatpak)); + assert!(CraftApp::by_id("gridcraft").unwrap().installs(crate::PackageKind::Dmg)); + } + #[test] fn pdfcraft_also_answers_to_printcraft() { let pdf = CraftApp::by_id("pdfcraft").unwrap(); diff --git a/crates/core/src/details.rs b/crates/core/src/details.rs index c6ee8c7c..7c4814c6 100644 --- a/crates/core/src/details.rs +++ b/crates/core/src/details.rs @@ -139,7 +139,7 @@ pub fn screenshot_within_budget(bytes: &[u8]) -> bool { /// Where every Craft App runs (getartcraft.com lists the same for each of them). const PLATFORMS: &str = "macOS, Windows, Linux, FreeBSD, web"; -pub const DETAILS: [AppDetails; 13] = [ +pub const DETAILS: [AppDetails; 14] = [ AppDetails { id: "photocraft", headline: "The image editor you already know how to use.", @@ -474,6 +474,24 @@ pub const DETAILS: [AppDetails; 13] = [ shots: &[], platforms: PLATFORMS, }, + AppDetails { + id: "solidcraft", + headline: "Parametric 3D CAD, in pure Rust.", + about: "A parametric solid modeller by Tangency Labs. Sketch, constrain and build solids on an editable feature \ + timeline: change a dimension and the model rebuilds. Early, but usable for simple parts. Open source, \ + and it can be driven by AI agents through its MCP server.", + features: &[ + feature( + "Sketches and constraints", + "Lines, arcs, splines and text, solved by SolidCraft's own constraint solver, with parameter-driven dimensions.", + ), + feature("Features", "Extrude, revolve, sweep, loft, fillet, chamfer, shell, holes, threads and patterns on a parametric timeline."), + feature("Files", "STEP, IGES, 3MF, STL, OBJ and glTF in and out where supported, and .sc designs."), + feature("Desktop, web and agents", "A desktop app, a browser app, a headless CLI and an MCP server, all running the same commands."), + ], + shots: &[], + platforms: PLATFORMS, + }, ]; impl AppDetails { diff --git a/crates/native/src/detect.rs b/crates/native/src/detect.rs index 3f83b944..88b6537c 100644 --- a/crates/native/src/detect.rs +++ b/crates/native/src/detect.rs @@ -88,7 +88,8 @@ pub(crate) fn appimage_version(name: &str, stems: &[&str]) -> Option bool { - publisher == PUBLISHER && app.names().any(|n| n == display_name) + publisher == app.msi_publisher.unwrap_or(PUBLISHER) && app.names().any(|n| n == display_name) } /// Where a Windows install of `app` may keep its exe, in the order to try: the entry's @@ -183,7 +184,9 @@ pub mod macos { pub fn read_bundle(app: &CraftApp, path: &Path) -> Option { let plist = plist::Value::from_file(path.join("Contents/Info.plist")).ok()?; let dict = plist.as_dictionary()?; - if dict.get("CFBundleIdentifier")?.as_string()? != app.bundle_id() { + // Its current bundle id or an older one (SolidCraft was ai.storyteller.solidcraft). + let id = dict.get("CFBundleIdentifier")?.as_string()?; + if !app.bundle_ids().any(|b| b == id) { return None; } // `Version` carries the full version including a pre-release suffix; @@ -457,7 +460,9 @@ pub mod linux { if let Some(list) = crate::process::capture_flatpak(&["list", "--app", &arch, "--columns=application,version"], t) { let mut flatpaks = packages::parse_flatpak_list(&list); // Bundles built from a release tarball often list no version: ask Flatpak directly. - for (id, version) in flatpaks.iter_mut().filter(|(id, v)| v.is_empty() && id.starts_with("ai.storyteller.")) { + for (id, version) in + flatpaks.iter_mut().filter(|(id, v)| v.is_empty() && artcraft_launcher_core::SUITE.iter().any(|a| a.bundle_ids().any(|b| b == *id))) + { if let Some(v) = crate::process::capture_flatpak(&["info", &arch, id], t).as_deref().and_then(packages::parse_flatpak_info) { *version = v; } @@ -541,7 +546,8 @@ pub mod linux { } let order = [InstallSource::Deb, InstallSource::Rpm, InstallSource::Pacman, InstallSource::Flatpak]; if let Some(p) = packages::find(app, &snapshot.packages, &order) { - let location = if p.manager == InstallSource::Flatpak { app.bundle_id() } else { binary_on_path(app.id) }; + // A Flatpak runs under the id it was found under, which may be an older one. + let location = if p.manager == InstallSource::Flatpak { p.name.clone() } else { binary_on_path(app.id) }; return Some(Installed { version: packages::version_of(p), source: p.manager, location, package: Some(p.name.clone()) }); } detect_system_install(app) @@ -605,6 +611,9 @@ mod linux_tests { }; assert!(ours("photocraft")); assert!(ours("ai.storyteller.photocraft")); + assert!(ours("io.tangencylabs.solidcraft")); + assert!(ours("ai.storyteller.solidcraft")); + assert!(ours("ai.storyteller.solvecraft")); assert!(!ours("unrelated-package")); } @@ -879,6 +888,14 @@ mod tests { } } + #[test] + fn solidcraft_matches_its_own_installer_publisher_only() { + let sc = CraftApp::by_id("solidcraft").unwrap(); + assert!(is_installer_entry(sc, "SolidCraft", "SolidCraft contributors")); + assert!(!is_installer_entry(sc, "SolidCraft", LEARNING_MACHINES)); + assert!(!is_installer_entry(CraftApp::by_id("cadcraft").unwrap(), "CADCraft", "SolidCraft contributors")); + } + #[test] fn pdfcraft_exe_is_sought_under_every_name_it_has_shipped_as() { let pdf = CraftApp::by_id("pdfcraft").unwrap(); @@ -899,9 +916,10 @@ mod tests { let roots = roots(); let location = PathBuf::from(r"D:\Apps\Somewhere"); for a in SUITE.iter().filter(|a| a.former_ids.is_empty() && a.former_names.is_empty()) { - assert!(is_installer_entry(a, a.name, LEARNING_MACHINES), "{}", a.name); + let publisher = a.msi_publisher.unwrap_or(LEARNING_MACHINES); + assert!(is_installer_entry(a, a.name, publisher), "{}", a.name); assert!(!is_installer_entry(a, a.name, "Some Other Publisher"), "{}", a.name); - assert!(!is_installer_entry(a, &a.name.to_lowercase(), LEARNING_MACHINES), "{}", a.name); + assert!(!is_installer_entry(a, &a.name.to_lowercase(), publisher), "{}", a.name); let exe = format!("{}.exe", a.id); let in_program_files: Vec = roots.iter().map(|r| r.join(a.name).join(&exe)).collect(); assert_eq!(exe_candidates(a, None, &roots), in_program_files); diff --git a/crates/native/src/install.rs b/crates/native/src/install.rs index acf2054a..2e327483 100644 --- a/crates/native/src/install.rs +++ b/crates/native/src/install.rs @@ -141,7 +141,12 @@ pub fn install_at( } #[cfg(target_os = "linux")] PackageKind::Deb | PackageKind::Rpm | PackageKind::ArchPkg | PackageKind::Flatpak => { - linux::install_package(kind, &file, job.stop, &mut *job.phase).map(|_| None) + linux::install_package(kind, &file, job.stop, &mut *job.phase).map(|_| { + if kind == PackageKind::Flatpak { + linux::retire_former_flatpak(app, existing); + } + None + }) } #[cfg(target_os = "linux")] PackageKind::AppImage => { @@ -391,6 +396,9 @@ pub(crate) fn choose_kinds_with( available: &[PackageKind], can_pacman: bool, ) -> Vec { + // Formats the launcher can't verify for this app (SolidCraft's unsigned macOS build) never count. + let available: Vec = available.iter().copied().filter(|k| app.installs(*k)).collect(); + let available = available.as_slice(); if let Some(inst) = existing { let kind = match inst.source { InstallSource::Launcher => record.map(|r| r.kind), @@ -625,7 +633,8 @@ pub fn launch(app: &CraftApp, installed: &Installed, paths: &Paths) -> Result<() match installed.source { InstallSource::Flatpak => { let mut cmd = process::flatpak_command(); - cmd.args(["run", &app.bundle_id()]); + // The id detection found it under, which may be one of the app's older ones. + cmd.args(["run", &installed.package.clone().unwrap_or_else(|| app.bundle_id())]); process::spawn_detached(cmd) } InstallSource::MacApp => process::open(path.as_os_str()), @@ -1043,20 +1052,22 @@ pub(crate) mod linux { pub fn remove_package(app: &CraftApp, installed: &Installed, stop: &Stop, phase: &mut dyn FnMut(JobPhase)) -> Result<(), String> { let mut remove = |command: &[&str], package: &str| as_root(&SYSTEM, command, OsStr::new(package), stop, phase, JobPhase::Removing); + let package = installed.package.as_deref().unwrap_or(app.id); match installed.source { - InstallSource::Deb if system_tool("apt-get").is_some() => remove(&["apt-get", "-o", APT_WAITS, "remove", "-y"], app.id), - InstallSource::Deb => remove(&["dpkg", "-r"], app.id), + // The package detected (photocraft, or ai.storyteller.photocraft). + InstallSource::Deb if system_tool("apt-get").is_some() => remove(&["apt-get", "-o", APT_WAITS, "remove", "-y"], package), + InstallSource::Deb => remove(&["dpkg", "-r"], package), InstallSource::Rpm => { if system_tool("dnf").is_some() { - remove(&["dnf", "remove", "-y"], app.id) + remove(&["dnf", "remove", "-y"], package) } else { - remove(&["rpm", "-e"], app.id) + remove(&["rpm", "-e"], package) } } // The package detected (photocraft, photocraft-bin or photocraft-git). - InstallSource::Pacman => remove(&["pacman", "-R", "--noconfirm"], installed.package.as_deref().unwrap_or(app.id)), + InstallSource::Pacman => remove(&["pacman", "-R", "--noconfirm"], package), InstallSource::Flatpak => { - let id = app.bundle_id(); + let id = installed.package.clone().unwrap_or_else(|| app.bundle_id()); let user = process::flatpak_command().args(["uninstall", "--user", "-y", "--noninteractive", &id]).status(); if user.is_ok_and(|s| s.success()) { return Ok(()); @@ -1074,6 +1085,28 @@ pub(crate) mod linux { } } + /// The older Flatpak id `app` was found under before an update, if it's one of its own + /// ([`CraftApp::former_bundles`]) and not the current id. + pub(crate) fn former_flatpak<'a>(app: &CraftApp, existing: Option<&'a Installed>) -> Option<&'a str> { + let old = existing.filter(|i| i.source == InstallSource::Flatpak)?.package.as_deref()?; + (old != app.bundle_id() && app.former_bundles.contains(&old)).then_some(old) + } + + /// After a Flatpak update of an app that was installed under one of its older ids, removes + /// that old copy, which would otherwise come back once the new one is removed. Its data + /// folder (`~/.var/app/`) stays: the new app copies its settings from there on its + /// first launch. + pub fn retire_former_flatpak(app: &CraftApp, existing: Option<&Installed>) { + let Some(old) = former_flatpak(app, existing) else { return }; + for scope in ["--user", "--system"] { + if process::flatpak_command().args(["uninstall", scope, "-y", "--noninteractive", old]).status().is_ok_and(|s| s.success()) { + log::info!("{}: removed the old Flatpak {old}; its data stays for the new app", app.name); + return; + } + } + log::warn!("{}: couldn't remove the old Flatpak {old}; `flatpak uninstall {old}` removes it", app.name); + } + pub fn install_appimage( file: &Path, name: &str, @@ -2676,6 +2709,29 @@ mod tests { assert_eq!(choose_kinds_with(app, Some(&installed), None, &[PackageKind::ArchPkg], &[PackageKind::ArchPkg], true), Vec::::new()); } + #[test] + fn solidcraft_is_never_installed_from_its_unsigned_macos_build() { + let sc = artcraft_launcher_core::CraftApp::by_id("solidcraft").unwrap(); + assert_eq!(choose_kinds_with(sc, None, None, &[], &[PackageKind::Dmg], false), Vec::::new()); + let photo = artcraft_launcher_core::CraftApp::by_id("photocraft").unwrap(); + assert_eq!(choose_kinds_with(photo, None, None, &[], &[PackageKind::Dmg], false), [PackageKind::Dmg]); + } + + #[cfg(target_os = "linux")] + #[test] + fn only_an_apps_own_older_flatpak_id_is_retired() { + use super::linux::former_flatpak; + let flatpak = |id: &str| Installed { version: None, source: InstallSource::Flatpak, location: id.into(), package: Some(id.into()) }; + let sc = artcraft_launcher_core::CraftApp::by_id("solidcraft").unwrap(); + let old = flatpak("ai.storyteller.solvecraft"); + assert_eq!(former_flatpak(sc, Some(&old)), Some("ai.storyteller.solvecraft")); + assert_eq!(former_flatpak(sc, Some(&flatpak("io.tangencylabs.solidcraft"))), None); + assert_eq!(former_flatpak(sc, Some(&flatpak("ai.storyteller.cadcraft"))), None); + assert_eq!(former_flatpak(sc, None), None); + let deb = Installed { source: InstallSource::Deb, ..old.clone() }; + assert_eq!(former_flatpak(sc, Some(&deb)), None); + } + #[test] fn release_arch_packages_are_updated_as_arch_pkg() { let pacman = |name: &str| Installed { version: None, source: InstallSource::Pacman, location: String::new(), package: Some(name.into()) }; diff --git a/crates/native/src/packages.rs b/crates/native/src/packages.rs index 7af538c1..410d0bb3 100644 --- a/crates/native/src/packages.rs +++ b/crates/native/src/packages.rs @@ -69,7 +69,7 @@ pub fn parse_flatpak_info(text: &str) -> Option { /// (`photocraft`) or the reverse-DNS bundle id (`ai.storyteller.photocraft`). pub fn candidate_names(app: &CraftApp, manager: InstallSource) -> Vec { match manager { - InstallSource::Flatpak => vec![app.bundle_id()], + InstallSource::Flatpak => app.bundle_ids().collect(), InstallSource::Pacman => { app.stems().flat_map(|s| [s.to_string(), format!("{s}-bin"), format!("{s}-git")]).chain(std::iter::once(app.bundle_id())).collect() } @@ -116,6 +116,18 @@ mod tests { assert_eq!(parse_flatpak_info("Version: \n"), None); } + #[test] + fn solidcraft_flatpak_is_found_under_its_older_ids_current_first() { + let sc = CraftApp::by_id("solidcraft").unwrap(); + let old = pkgs(InstallSource::Flatpak, parse_flatpak_list("ai.storyteller.solvecraft\t0.7.0\n")); + assert_eq!(find(sc, &old, &[InstallSource::Flatpak]).map(|p| p.name.as_str()), Some("ai.storyteller.solvecraft")); + let both = pkgs(InstallSource::Flatpak, parse_flatpak_list("ai.storyteller.solidcraft\t0.8.0\nio.tangencylabs.solidcraft\t0.25.1\n")); + assert_eq!(find(sc, &both, &[InstallSource::Flatpak]).map(|p| p.name.as_str()), Some("io.tangencylabs.solidcraft")); + // Another app's old id never matches SolidCraft. + let other = pkgs(InstallSource::Flatpak, parse_flatpak_list("ai.storyteller.cadcraft\t0.3.0\n")); + assert!(find(sc, &other, &[InstallSource::Flatpak]).is_none()); + } + #[test] fn candidate_names_cover_bundle_ids_for_deb_rpm_and_pacman() { let photo = CraftApp::by_id("photocraft").unwrap(); diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 082139a9..3f5d3088 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7,6 +7,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} od {name} Open Source Tools for Creatives, Makers, and Builders Open-source nástroje pro kreativce, tvůrce a vývojáře Settings Nastavení Check for updates Zkontrolovat aktualizace @@ -155,6 +156,7 @@ designcraft Page layout and publishing Sazba stránek a publikování wordcraft Writing and document design Psaní a návrh dokumentů deckcraft Presentations and slide shows Prezentace a promítání snímků gridcraft Spreadsheets and data Tabulky a data +solidcraft Parametric 3D CAD Parametrické 3D CAD cadcraft Computer-aided design and drafting Počítačem podporované navrhování a kreslení soundcraft Recording, editing and mixing audio Nahrávání, úpravy a mixování zvuku figcraft Interface design and prototyping Návrh rozhraní a prototypování @@ -349,3 +351,4 @@ filter Installed Nainstalováno Show {n} more changes Zobrazit dalších změn: {n} Last updated: {date} Naposledy aktualizováno: {date} column Version Verze +column Author Autor diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 8e4b94d2..73620641 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -21,6 +21,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} von {name} Open Source Tools for Creatives, Makers, and Builders Open-Source-Werkzeuge für Kreative, Maker und Entwickler Settings Einstellungen Check for updates Nach Updates suchen @@ -173,6 +174,7 @@ designcraft Page layout and publishing Seitenlayout und Publishing wordcraft Writing and document design Schreiben und Dokumentgestaltung deckcraft Presentations and slide shows Präsentationen und Diashows gridcraft Spreadsheets and data Tabellenkalkulation und Daten +solidcraft Parametric 3D CAD Parametrisches 3D-CAD cadcraft Computer-aided design and drafting Computergestütztes Konstruieren und Zeichnen soundcraft Recording, editing and mixing audio Audio aufnehmen, bearbeiten und mischen figcraft Interface design and prototyping Interface-Design und Prototyping @@ -381,3 +383,4 @@ filter Installed Installiert Show {n} more changes {n} weitere Änderungen anzeigen Last updated: {date} Zuletzt aktualisiert: {date} column Version Version +column Author Autor diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 9f9fab8a..f7a1fb0f 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -21,6 +21,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} por {name} Open Source Tools for Creatives, Makers, and Builders Herramientas de código abierto para creativos, makers y constructores Settings Ajustes Check for updates Buscar actualizaciones @@ -168,6 +169,7 @@ designcraft Page layout and publishing Maquetación y publicación wordcraft Writing and document design Escritura y diseño de documentos deckcraft Presentations and slide shows Presentaciones y diapositivas gridcraft Spreadsheets and data Hojas de cálculo y datos +solidcraft Parametric 3D CAD CAD 3D paramétrico cadcraft Computer-aided design and drafting CAD: diseño y dibujo técnico soundcraft Recording, editing and mixing audio Grabación, edición y mezcla de audio figcraft Interface design and prototyping Diseño de interfaces y prototipos @@ -362,3 +364,4 @@ filter Installed Instaladas Show {n} more changes Mostrar {n} cambios más Last updated: {date} Última actualización: {date} column Version Versión +column Author Autor diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 2ee5c239..7c7eec6d 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -19,6 +19,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} par {name} Open Source Tools for Creatives, Makers, and Builders Des outils open source pour les créatifs, les makers et les bâtisseurs Settings Réglages Check for updates Rechercher des mises à jour @@ -171,6 +172,7 @@ designcraft Page layout and publishing Mise en page et édition wordcraft Writing and document design Rédaction et mise en forme de documents deckcraft Presentations and slide shows Présentations et diaporamas gridcraft Spreadsheets and data Tableurs et données +solidcraft Parametric 3D CAD CAO paramétrique 3D cadcraft Computer-aided design and drafting Conception et dessin assistés par ordinateur soundcraft Recording, editing and mixing audio Enregistrement, édition et mixage audio figcraft Interface design and prototyping Design d'interfaces et prototypage @@ -379,3 +381,4 @@ filter Installed Installées Show {n} more changes Afficher {n} modifications de plus Last updated: {date} Dernière mise à jour : {date} column Version Version +column Author Auteur diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 7c574915..fbc434f1 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -21,6 +21,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} készítette: {name} Open Source Tools for Creatives, Makers, and Builders Nyílt forráskódú eszközök alkotóknak, barkácsolóknak és fejlesztőknek Settings Beállítások Check for updates Frissítések keresése @@ -173,6 +174,7 @@ designcraft Page layout and publishing Oldaltervezés és kiadványszerkesztés wordcraft Writing and document design Írás és dokumentumtervezés deckcraft Presentations and slide shows Prezentációk és diavetítések gridcraft Spreadsheets and data Táblázatok és adatok +solidcraft Parametric 3D CAD Paraméteres 3D CAD cadcraft Computer-aided design and drafting Számítógépes tervezés és műszaki rajz soundcraft Recording, editing and mixing audio Hangrögzítés, hangszerkesztés és keverés figcraft Interface design and prototyping Felülettervezés és prototípus-készítés @@ -382,3 +384,4 @@ filter Installed Telepítve Show {n} more changes {n} további változás megjelenítése Last updated: {date} Utoljára frissítve: {date} column Version Verzió +column Author Szerző diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 1b5be803..77b94ed7 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -23,6 +23,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} {name} 提供 Open Source Tools for Creatives, Makers, and Builders クリエイター、メイカー、ビルダーのためのオープンソースツール Settings 設定 Check for updates 更新を確認 @@ -175,6 +176,7 @@ designcraft Page layout and publishing ページレイアウトと出版 wordcraft Writing and document design 文書作成とデザイン deckcraft Presentations and slide shows プレゼンテーションとスライドショー gridcraft Spreadsheets and data 表計算とデータ +solidcraft Parametric 3D CAD パラメトリック3D CAD cadcraft Computer-aided design and drafting コンピューター支援設計と製図 soundcraft Recording, editing and mixing audio オーディオの録音、編集、ミックス figcraft Interface design and prototyping インターフェースデザインとプロトタイピング @@ -384,3 +386,4 @@ filter Installed インストール済み Show {n} more changes さらに{n}件の変更を表示 Last updated: {date} 最終更新: {date} column Version バージョン +column Author 作者 diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index c7599206..9d5fa4a3 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -21,6 +21,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} przez {name} Open Source Tools for Creatives, Makers, and Builders Narzędzia open source dla artystów, twórców i konstruktorów Settings Ustawienia Check for updates Sprawdź dostępność aktualizacji @@ -174,6 +175,7 @@ designcraft Page layout and publishing Skład stron i publikowanie wordcraft Writing and document design Pisanie i projektowanie dokumentów deckcraft Presentations and slide shows Prezentacje i pokazy slajdów gridcraft Spreadsheets and data Arkusze kalkulacyjne i dane +solidcraft Parametric 3D CAD Parametryczny CAD 3D cadcraft Computer-aided design and drafting Projektowanie i kreślenie wspomagane komputerowo soundcraft Recording, editing and mixing audio Nagrywanie, edycja i miksowanie dźwięku figcraft Interface design and prototyping Projektowanie interfejsów i prototypowanie @@ -383,3 +385,4 @@ filter Installed Zainstalowane Show {n} more changes Pokaż {n} więcej zmian Last updated: {date} Ostatnia aktualizacja: {date} column Version Wersja +column Author Autor diff --git a/crates/ui-egui/src/i18n/pt-BR.tsv b/crates/ui-egui/src/i18n/pt-BR.tsv index a48e68fb..4539c8e6 100644 --- a/crates/ui-egui/src/i18n/pt-BR.tsv +++ b/crates/ui-egui/src/i18n/pt-BR.tsv @@ -8,6 +8,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} por {name} Open Source Tools for Creatives, Makers, and Builders Ferramentas de código aberto para criadores, artistas e desenvolvedores Settings Configurações Check for updates Verificar atualizações @@ -161,6 +162,7 @@ designcraft Page layout and publishing Diagramação de páginas e publicação wordcraft Writing and document design Escrita e design de documentos deckcraft Presentations and slide shows Apresentações e slides gridcraft Spreadsheets and data Planilhas e dados +solidcraft Parametric 3D CAD CAD 3D paramétrico cadcraft Computer-aided design and drafting Desenho técnico e projeto assistido por computador (CAD) soundcraft Recording, editing and mixing audio Gravação, edição e mixagem de áudio figcraft Interface design and prototyping Design de interfaces e prototipagem @@ -369,3 +371,4 @@ filter Installed Instalados Show {n} more changes Mostrar mais {n} alterações Last updated: {date} Última atualização: {date} column Version Versão +column Author Autor diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 3f96193d..bbb99e8b 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -20,6 +20,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} от {name} Open Source Tools for Creatives, Makers, and Builders Инструменты с открытым кодом для творцов, мастеров и создателей Settings Настройки Check for updates Проверить обновления @@ -171,6 +172,7 @@ designcraft Page layout and publishing Вёрстка и издательско wordcraft Writing and document design Тексты и оформление документов deckcraft Presentations and slide shows Презентации и слайд-шоу gridcraft Spreadsheets and data Электронные таблицы и данные +solidcraft Parametric 3D CAD Параметрический 3D CAD cadcraft Computer-aided design and drafting Автоматизированное проектирование и черчение soundcraft Recording, editing and mixing audio Запись, редактирование и сведение звука figcraft Interface design and prototyping Дизайн интерфейсов и прототипирование @@ -377,3 +379,4 @@ filter Installed Установлены Show {n} more changes Показать ещё изменений: {n} Last updated: {date} Последнее обновление: {date} column Version Версия +column Author Автор diff --git a/crates/ui-egui/src/i18n/zh-CN.tsv b/crates/ui-egui/src/i18n/zh-CN.tsv index 70b663d3..d1102a41 100644 --- a/crates/ui-egui/src/i18n/zh-CN.tsv +++ b/crates/ui-egui/src/i18n/zh-CN.tsv @@ -7,6 +7,7 @@ Launcher Launcher Craft App Suite Craft App Suite + by {name} 由 {name} 提供 Open Source Tools for Creatives, Makers, and Builders 为创作者和开发者打造的开源工具 Settings 设置 Check for updates 检查更新 @@ -249,6 +250,7 @@ designcraft Page layout and publishing 页面排版与出版 wordcraft Writing and document design 写作与文档设计 deckcraft Presentations and slide shows 演示文稿与幻灯片 gridcraft Spreadsheets and data 电子表格与数据处理 +solidcraft Parametric 3D CAD 参数化三维 CAD cadcraft Computer-aided design and drafting 计算机辅助设计与制图 soundcraft Recording, editing and mixing audio 音频录制、编辑与混音 figcraft Interface design and prototyping 界面设计与原型制作 @@ -348,4 +350,5 @@ figcraft Interface design and prototyping 界面设计与原型制作 Previous app 上一个应用 Show {n} more changes 显示另外 {n} 项更改 Last updated: {date} 最后更新:{date} +column Author 作者 column Version 版本 diff --git a/crates/ui-egui/src/model.rs b/crates/ui-egui/src/model.rs index 4fdb094f..80eaa0dd 100644 --- a/crates/ui-egui/src/model.rs +++ b/crates/ui-egui/src/model.rs @@ -40,7 +40,8 @@ impl AppEntry { pub fn has_download(&self, platform: Option) -> bool { let (Some(r), Some(p)) = (self.release(), platform) else { return false }; let stems: Vec<&str> = self.app.stems().collect(); - pick_asset(r, &stems, p, p.download_kinds()).is_some() + let kinds: Vec<_> = p.download_kinds().iter().copied().filter(|k| self.app.installs(*k)).collect(); + pick_asset(r, &stems, p, &kinds).is_some() } pub fn status(&self, platform: Option, manage_apps: bool) -> AppStatus { diff --git a/crates/ui-egui/src/views.rs b/crates/ui-egui/src/views.rs index df56d4f4..8bbdd2a3 100644 --- a/crates/ui-egui/src/views.rs +++ b/crates/ui-egui/src/views.rs @@ -1,6 +1,7 @@ //! The header, toolbar, footer, the grid of cards and the table, laid out like the apps page on //! getartcraft.com: hairline cells, mono labels and square controls. +use artcraft_launcher_core::catalog::AppKind; use artcraft_launcher_core::details::AppDetails; use artcraft_launcher_core::platform::pick_asset; use artcraft_launcher_core::protocol::{Command, JobPhase}; @@ -15,6 +16,17 @@ use crate::settings::{Filter, SortKey, ViewMode}; use crate::theme::{self, Tokens, rgb, tint}; use crate::widgets::{self, Kind}; +/// The byline that says who makes an app: "by ArtCraft" or "by ". Official apps take +/// the accent colour, community apps the muted one. +fn kind_badge(ui: &mut Ui, app: &artcraft_launcher_core::CraftApp, t: &Tokens) { + let text = fmt(tl!("by {name}"), &[("name", app.publisher)]); + let color = match app.kind { + AppKind::Official => t.accent_ink, + AppKind::Community => t.muted, + }; + widgets::badge(ui, &text, color); +} + /// Translate a relative timestamp ("just now", "5 min ago", …) into the current language. fn ago_text(secs: i64, now: i64) -> String { match time::ago_kind(secs, now) { @@ -514,6 +526,7 @@ impl LauncherUi { ui.spacing_mut().interact_size.y = 0.0; ui.horizontal(|ui| { widgets::wordmark_in(ui, app, 22.0, in_colour); + kind_badge(ui, app, &t); }); ui.add(egui::Label::new(RichText::new(tr_ctx(current(), app.id, app.tagline)).font(tagline.clone()).color(t.muted)).truncate()); }); @@ -574,6 +587,7 @@ impl LauncherUi { .column(Column::exact(176.0)) .column(Column::exact(150.0)) .column(Column::exact(104.0)) + .column(Column::exact(120.0)) .column(Column::exact(206.0)) .header(42.0, |header| self.table_header(header, &mut sort_clicked, &t, span, clip)) .body(|body| self.table_rows(body, ids, &t, (title_h, tagline_h), now, (span, clip))); @@ -656,6 +670,7 @@ impl LauncherUi { (Some(SortKey::Status), tl!("Status")), (None, tr_ctx(current(), "column", "Version")), (Some(SortKey::Released), tr_ctx(current(), "column", "Released")), + (None, tr_ctx(current(), "column", "Author")), (None, ""), ] { header.col(|ui| { @@ -670,7 +685,7 @@ impl LauncherUi { } /// The table's one row per app: the app (click to open its page), its status, the version, - /// when it was released, and its actions. + /// when it was released, who makes it, and its actions. fn table_rows( &mut self, mut body: egui_extras::TableBody<'_>, @@ -689,6 +704,9 @@ impl LauncherUi { row.col(|ui| self.table_status_cell(ui, &entry, &status, t)); row.col(|ui| self.table_version_cell(ui, &entry, &status, t)); row.col(|ui| self.table_released_cell(ui, &entry, now, t)); + row.col(|ui| { + ui.label(RichText::new(entry.app.publisher).color(t.muted)); + }); row.col(|ui| self.actions(ui, &entry, &status, 204.0)); }); } From 67aefb33c00c51f7e1feb1134516122fac26f434 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 29 Oct 2026 01:50:54 +0000 Subject: [PATCH 5/5] Install new Windows apps for everyone in Program Files\ArtCraft, and show that folder as the default (#972) * fix(installer): install new Windows apps for everyone, in Program Files\ArtCraft\ A fresh MSI install now asks Windows Installer for the machine-wide context (ALLUSERS=1) instead of taking the package's own default, which for a dual-scope package is per-user (%LOCALAPPDATA%). Updates are unchanged: they keep the context of the copy they replace. README row restored to Program Files. * fix(ui): show the real default install folder, not just "System default" The install-folder fields (the per-app Install dialog and Settings' Default install folder) now show the folder a fresh install really uses: Program Files\ArtCraft for a Windows MSI (machine-wide, from the ALLUSERS=1 scope), the launcher's own apps folder for a portable ZIP, /Applications on macOS. The host answers through the new Host::default_install_folder, computed by native install::default_folder; where no single default exists (web build, Linux system packages, FreeBSD) the field keeps saying "System default". The same value is the start folder of Browse, so it no longer starts at a literal "System default" string. * fix(review): the default folder follows the package and the installer CodeRabbit review of #972: the Windows default now follows the selected package's architecture (an x86 MSI picked because a release ships no x64 one installs under Program Files (x86)), and answers nothing when the architecture is unknown, so the field says "System default" rather than guessing. The macOS default comes from the installer's own applications_dir, so a machine where /Applications is not writable shows ~/Applications. Browse now starts at the nearest folder that exists, so a default created only by the first install (Program Files\ArtCraft) no longer falls back to the picker's unrelated start location. The desktop host memoises its answer because the macOS path probes the disk and the fields redraw often. * fix(review): keep the Linux and macOS builds of default_folder warning-free The ubuntu Clippy gate caught what the dev machine cannot check (ring needs a Linux C compiler): the Arch import is Windows-only, the macOS arm consumes its unused parameters, and the Linux test calls the three-argument signature. * fix(ci): import Arch on every target, default_folder's signature uses it everywhere 0f5bd68 gated the import to Windows but the signature names Arch on all targets, so the Linux clippy job failed with E0425. * fix(review): the folder hint matches the real install and touches nothing CodeRabbit review of #972. - The install dialog's default follows the package the backend will really install: the preferred formats first, then every other format this platform installs, as choose_kinds does. A Portable ZIP preference with a release that ships only an MSI now shows Program Files, not the apps folder. The choice lives in the new install_target module. - Settings covers every app, so it shows a folder only when every app that can be installed shares one; a 32-bit-only app beside a 64-bit one leaves it at "System default" instead of using the launcher's architecture. - The macOS hint no longer borrows the installer's probe, which wrote a fixed-name file in /Applications (following a planted link) and created ~/Applications when it fell back. Both now use write_probe (fresh name, create_new), and only the installer creates ~/Applications. - The desktop host caches each question, since Settings now asks per app. --- README.md | 2 +- apps/artcraft-launcher/src/main.rs | 40 +++++- crates/core/src/platform.rs | 23 ++++ crates/native/src/install.rs | 149 ++++++++++++++++++++--- crates/native/src/msi_context.rs | 35 ++++-- crates/ui-egui/src/app.rs | 9 +- crates/ui-egui/src/dialogs.rs | 4 +- crates/ui-egui/src/install_target.rs | 92 ++++++++++++++ crates/ui-egui/src/lib.rs | 1 + crates/ui-egui/src/settings_dialog.rs | 3 +- crates/ui-egui/tests/ui.rs | 167 ++++++++++++++++++++++++++ 11 files changed, 487 insertions(+), 38 deletions(-) create mode 100644 crates/ui-egui/src/install_target.rs diff --git a/README.md b/README.md index f73c51ae..604d5591 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ installed by hand (and the launcher finds apps you installed yourself): | System | Where | How | |---|---|---| | macOS | `/Applications/.app` | Copied from the signed, notarized release DMG | -| Windows | `%LOCALAPPDATA%\Programs\ArtCraft\` | The release MSI, through Windows Installer, for your account only so there is no administrator prompt (with Start menu entry and Apps & features entry). An app already installed for everyone (`C:\Program Files\ArtCraft\`, or `Program Files (x86)` for a 32-bit build) keeps its folder and scope when updated. A custom folder this account can't write to (such as one under `Program Files`) installs for everyone, with an administrator prompt | +| Windows | `C:\Program Files\ArtCraft\` (`Program Files (x86)` for a 32-bit build) | The release MSI, through Windows Installer, for everyone on the computer (with Start menu entry and Apps & features entry). Windows asks for administrator permission for each new install. An app already installed for your account only (`%LOCALAPPDATA%\Programs\ArtCraft\`) keeps its folder and scope when updated; to move it, uninstall it and install it again | | Linux | `/usr/bin`, `/usr/share/applications` | The release `.deb` (apt) or `.rpm` (dnf, zypper), with your system's password prompt. Without those, a Flatpak, or an AppImage in `~/Applications` | | Linux, inside the launcher's Flatpak, with no Flatpak on the host | `~/.var/app/ai.storyteller.artcraft-launcher/data/artcraft-launcher/apps/` | The release tarball, unpacked into the launcher's own folder and run inside the same sandbox, with its settings in a `home/` folder beside it. Nothing is installed on the host, and each app's configuration stays in the sandbox | | FreeBSD | `/usr/local` | The release tree, with a password prompt (polkit); `~/.local` when polkit isn't installed | diff --git a/apps/artcraft-launcher/src/main.rs b/apps/artcraft-launcher/src/main.rs index b7b7b0ca..2c0e9109 100644 --- a/apps/artcraft-launcher/src/main.rs +++ b/apps/artcraft-launcher/src/main.rs @@ -454,6 +454,13 @@ fn tray_step(requests: &[Request]) -> TrayStep { } } +/// The nearest folder at or above `initial` that exists, so Browse starts near a default that is +/// often created only by the first install (`Program Files\ArtCraft`). +fn nearest_existing_folder(initial: Option<&str>) -> Option { + let folder = initial.map(std::path::PathBuf::from)?; + folder.ancestors().find(|candidate| candidate.is_dir()).map(|folder| folder.to_path_buf()) +} + /// What `LauncherUi::logic` is told about its window while there is none: it isn't focused. fn no_window() -> egui::RawInput { let viewport = egui::ViewportInfo { focused: Some(false), ..Default::default() }; @@ -475,9 +482,16 @@ fn claim_notification_identity() -> &'static Result<(), String> { }) } +/// A default-folder question (format and architecture) with the host's answer. +type DefaultFolderAnswer = ((artcraft_launcher_core::PackageKind, Option), Option); + struct DesktopHost { tray: bool, quit: bool, + /// Default-folder answers by question: the fields redraw often while a dialog is open, + /// Settings asks once per app's package, and the macOS answer probes the disk. There are + /// only a handful of distinct questions (format and architecture). + default_folders: Vec, } impl Host for DesktopHost { @@ -521,12 +535,23 @@ impl Host for DesktopHost { fn pick_folder(&mut self, initial: Option<&str>) -> Option { let mut dialog = rfd::FileDialog::new(); - if let Some(folder) = initial.filter(|p| std::path::Path::new(p).is_dir()) { + if let Some(folder) = nearest_existing_folder(initial) { dialog = dialog.set_directory(folder); } dialog.pick_folder().and_then(|p| p.to_str().map(str::to_string)) } + fn default_install_folder(&mut self, kind: artcraft_launcher_core::PackageKind, arch: Option) -> Option { + if let Some((_, answer)) = self.default_folders.iter().find(|(question, _)| *question == (kind, arch)) { + return answer.clone(); + } + let answer = artcraft_launcher_native::paths::Paths::new().ok().and_then(|paths| { + artcraft_launcher_native::install::default_folder(kind, arch, &paths).and_then(|folder| folder.to_str().map(str::to_string)) + }); + self.default_folders.push(((kind, arch), answer.clone())); + answer + } + fn reduce_motion(&self) -> bool { motion::reduced() } @@ -576,7 +601,7 @@ impl Launcher { system_theme: system_theme::Monitor::default(), ui: LauncherUi::new(&windowless, backend, Settings::default()), tray: None, - host: DesktopHost { tray: false, quit: false }, + host: DesktopHost { tray: false, quit: false, default_folders: Vec::new() }, starts, windowless, run_again, @@ -911,6 +936,17 @@ mod tests { (Launcher::new(Box::new(Quiet(seen.clone())), show_requests, None), show, seen) } + #[test] + fn browse_starts_at_the_nearest_folder_that_exists() { + let existing = std::env::temp_dir(); + assert_eq!(nearest_existing_folder(None), None); + // A default like `Program Files\ArtCraft` is often created only by the first install: + // Browse then starts one level up, where the eye can find it again. + let missing = existing.join("artcraft-launcher-does-not-exist-yet"); + assert_eq!(nearest_existing_folder(missing.to_str()), Some(existing.clone())); + assert_eq!(nearest_existing_folder(existing.to_str()), Some(existing)); + } + #[test] fn saved_filters_are_migrated_when_desktop_settings_load() { use artcraft_launcher_ui_egui::settings::Filter; diff --git a/crates/core/src/platform.rs b/crates/core/src/platform.rs index 440098e7..3467e579 100644 --- a/crates/core/src/platform.rs +++ b/crates/core/src/platform.rs @@ -191,6 +191,20 @@ pub struct AssetName { pub kind: PackageKind, } +impl AssetName { + /// The architecture the asset is built for: the last part of its token (`windows-x86` → x86). + /// `None` for a token that names none (`macos-universal`). + pub fn arch(&self) -> Option { + match self.token.rsplit('-').next()? { + "x64" | "x86_64" => Some(Arch::X64), + "x86" => Some(Arch::X86), + "arm64" | "aarch64" => Some(Arch::Arm64), + "riscv64" => Some(Arch::Riscv64), + _ => None, + } + } +} + /// Reads `---[-portable].`; `None` for checksums, zsync files, CLI /// and web bundles, or anything else. pub fn parse_asset_name(name: &str, stems: &[&str]) -> Option { @@ -327,6 +341,15 @@ mod tests { } } + #[test] + fn asset_names_carry_their_architecture() { + let arch = |name: &str| parse_asset_name(name, &["photocraft"]).unwrap().arch(); + assert_eq!(arch("photocraft-0.5.0-windows-x64.msi"), Some(Arch::X64)); + assert_eq!(arch("photocraft-0.5.0-windows-x86.msi"), Some(Arch::X86)); + assert_eq!(arch("photocraft-0.5.0-linux-aarch64.tar.gz"), Some(Arch::Arm64)); + assert_eq!(arch("photocraft-0.5.0-macos-universal.dmg"), None); + } + #[test] fn reads_asset_names() { let n = parse_asset_name("photocraft-0.2.0-rc.1-windows-arm64-portable.zip", &["photocraft"]).unwrap(); diff --git a/crates/native/src/install.rs b/crates/native/src/install.rs index 2e327483..a1702362 100644 --- a/crates/native/src/install.rs +++ b/crates/native/src/install.rs @@ -23,6 +23,7 @@ use std::path::{Path, PathBuf}; +use artcraft_launcher_core::Arch; use artcraft_launcher_core::protocol::{CANCELLED, INSTALL_CANCELLED, InstallLocations, JobPhase}; use artcraft_launcher_core::release::{self, Asset, Release}; use artcraft_launcher_core::{CraftApp, InstallSource, Installed, PackageKind, version}; @@ -102,8 +103,8 @@ pub fn install_at( crate::msi_context::probe, |code| crate::detect::windows::record_scope(app, code), )?; - // A fresh install keeps the package's own default unless the chosen folder needs administrator rights. - updated.or_else(|| if existing.is_none() { crate::msi_context::fresh_scope(destination.as_deref(), can_create_files_in) } else { None }) + // A fresh install is machine-wide (Program Files); an update keeps the context of the copy it replaces. + crate::msi_context::install_scope(updated, existing.is_none()) } else { None }; @@ -287,6 +288,42 @@ fn destination( Ok(Some(if kind == PackageKind::Msi { parent.join(app.name) } else { parent })) } +/// The folder a new install goes inside when the person hasn't chosen one, so the UI can show +/// that folder instead of only saying "System default". The answer follows the package: a +/// Windows MSI installs for everyone into `Program Files\ArtCraft\`, and a 32-bit package +/// into the 32-bit Program Files, so `arch` is the package's architecture when the release names +/// one and `None` (the release is unknown) answers nothing. A portable ZIP unpacks into the +/// launcher's own `apps` folder. A macOS app goes wherever the installer would put it +/// (`/Applications`, or `~/Applications` when the system folder is not writable). Formats the +/// system itself manages (the distro's packages on Linux, Flatpak) have no single folder, so +/// they answer `None`. +pub fn default_folder(kind: PackageKind, arch: Option, paths: &Paths) -> Option { + #[cfg(windows)] + { + match kind { + PackageKind::Msi => match arch { + Some(Arch::X86) => { + Some(PathBuf::from(std::env::var_os("ProgramFiles(x86)").or_else(|| std::env::var_os("ProgramFiles"))?).join("ArtCraft")) + } + Some(_) => Some(PathBuf::from(std::env::var_os("ProgramFiles")?).join("ArtCraft")), + None => None, + }, + PackageKind::PortableZip => Some(paths.apps()), + _ => None, + } + } + #[cfg(target_os = "macos")] + { + let _ = (arch, paths); + (kind == PackageKind::Dmg).then(macos::default_applications_dir).flatten() + } + #[cfg(not(any(windows, target_os = "macos")))] + { + let _ = (kind, arch, paths); + None + } +} + fn selected_folder(folder: &str, writable: bool) -> Result { let path = if folder == "~" { dirs::home_dir().ok_or("no home folder")? @@ -322,11 +359,17 @@ fn write_probe(dir: &Path) -> std::io::Result<()> { std::fs::remove_file(&probe) } -/// Whether this account can create files where `path` goes: `path` itself, or the nearest folder above it -/// that exists (an install folder is created by the installer). -#[cfg(windows)] -fn can_create_files_in(path: &Path) -> bool { - path.ancestors().find(|folder| folder.is_dir()).is_some_and(|folder| write_probe(folder).is_ok()) +/// The folder a new macOS app goes inside: `system` (`/Applications`) when this account can +/// create files there, else `Applications` in `home`. It creates nothing, so the install-folder +/// hint can ask on a redraw: `write_probe` takes a fresh name with `create_new`, so a link +/// planted in `/Applications` is never followed and no existing file is touched. The installer +/// creates `~/Applications` itself when it gets that answer. +#[cfg(any(target_os = "macos", test))] +fn mac_applications_dir(system: &Path, home: Option<&Path>) -> Option { + if write_probe(system).is_ok() { + return Some(system.to_path_buf()); + } + home.map(|home| home.join("Applications")) } #[cfg(any(windows, test))] @@ -340,8 +383,7 @@ fn msi_folder_argument(path: &Path) -> Result { /// The Windows Installer context an update must keep. A per-machine install elevates and writes /// HKLM registrations; a per-user one must not silently become a second, per-machine copy (or -/// the other way round). A fresh install passes `None` and takes the package's own default, -/// which is per-user for a dual-scope package. +/// the other way round). A fresh install is always `PerMachine`. #[cfg(any(windows, test))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum MsiScope { @@ -1344,7 +1386,9 @@ pub mod macos { use super::{CraftApp, InstallSource, Installed, Path, PathBuf, Paths, Release, process, staging_dir, swap_into_place}; - /// `/Applications` when we can write there, else `~/Applications`. + const SYSTEM_APPLICATIONS: &str = "/Applications"; + + /// `/Applications` when we can write there, else `~/Applications`, which is created. fn applications_dir(existing: Option<&Installed>, destination: Option<&Path>) -> Result { if let Some(parent) = existing.filter(|i| i.source == InstallSource::MacApp).and_then(|i| Path::new(&i.location).parent().map(Path::to_path_buf)) @@ -1354,15 +1398,16 @@ pub mod macos { if let Some(dir) = destination { return Ok(dir.to_path_buf()); } - let system = PathBuf::from("/Applications"); - let probe = system.join(".artcraft-launcher-write-test"); - if std::fs::write(&probe, b"").is_ok() { - let _ = std::fs::remove_file(&probe); - return Ok(system); + let dir = default_applications_dir().ok_or("no home folder")?; + if dir != Path::new(SYSTEM_APPLICATIONS) { + std::fs::create_dir_all(&dir).map_err(|e| format!("couldn't create {} ({e})", dir.display()))?; } - let user = dirs::home_dir().ok_or("no home folder")?.join("Applications"); - std::fs::create_dir_all(&user).map_err(|e| format!("couldn't create {} ({e})", user.display()))?; - Ok(user) + Ok(dir) + } + + /// The same choice as a fresh install makes, creating nothing: the install-folder hint. + pub(super) fn default_applications_dir() -> Option { + super::mac_applications_dir(Path::new(SYSTEM_APPLICATIONS), dirs::home_dir().as_deref()) } /// The Apple Developer team that signs every Craft App and ArtCraft Launcher (Learning @@ -1891,6 +1936,74 @@ mod tests { assert_eq!(keep_if_in_scope(None, true), None); } + /// The default folder shown in the UI is the one a fresh install really uses. + #[cfg(windows)] + #[test] + fn the_default_folder_is_the_artcraft_suite_folder_in_program_files() { + let paths = Paths::under(std::path::Path::new(r"C:\scratch")); + let program_files = std::env::var_os("ProgramFiles").map(PathBuf::from).unwrap(); + assert_eq!(default_folder(PackageKind::Msi, Some(Arch::X64), &paths), Some(program_files.join("ArtCraft"))); + assert_eq!(default_folder(PackageKind::PortableZip, Some(Arch::X64), &paths), Some(paths.apps())); + assert_eq!(default_folder(PackageKind::Dmg, Some(Arch::X64), &paths), None); + } + + /// A 32-bit package installs under the 32-bit Program Files; an unknown architecture answers + /// nothing, so the UI says "System default" instead of guessing the destination. + #[cfg(windows)] + #[test] + fn a_32_bit_package_uses_the_32_bit_program_files_and_an_unknown_architecture_answers_nothing() { + let paths = Paths::under(std::path::Path::new(r"C:\scratch")); + let x86 = std::env::var_os("ProgramFiles(x86)").or_else(|| std::env::var_os("ProgramFiles")).map(PathBuf::from).unwrap(); + assert_eq!(default_folder(PackageKind::Msi, Some(Arch::X86), &paths), Some(x86.join("ArtCraft"))); + assert_eq!(default_folder(PackageKind::Msi, None, &paths), None); + } + + #[cfg(target_os = "macos")] + #[test] + fn the_default_folder_is_wherever_the_installer_would_put_a_new_app() { + let paths = Paths::under(std::path::Path::new("/tmp/scratch")); + // `/Applications` when we can write there, else `~/Applications`: the same choice the + // installer makes, so the hint never disagrees with where the app really goes. + assert_eq!(default_folder(PackageKind::Dmg, None, &paths), macos::default_applications_dir()); + assert_eq!(default_folder(PackageKind::Msi, None, &paths), None); + } + + /// The macOS default-folder answer is asked on a redraw, so it must leave the disk as it was: + /// nothing left in a writable `/Applications`, no `~/Applications` created when it is not. + #[test] + fn the_mac_default_folder_lookup_creates_nothing() { + let system = tempfile::tempdir().unwrap(); + let home = tempfile::tempdir().unwrap(); + assert_eq!(mac_applications_dir(system.path(), Some(home.path())), Some(system.path().to_path_buf())); + assert_eq!(std::fs::read_dir(system.path()).unwrap().count(), 0, "the write probe was left behind"); + + let unwritable = system.path().join("missing"); + assert_eq!(mac_applications_dir(&unwritable, Some(home.path())), Some(home.path().join("Applications"))); + assert!(!home.path().join("Applications").exists(), "a folder hint must not create ~/Applications"); + assert_eq!(mac_applications_dir(&unwritable, None), None); + } + + /// A link planted under the old fixed probe name must not be followed: the probe once wrote + /// through it and truncated whatever it pointed at. + #[cfg(unix)] + #[test] + fn the_mac_default_folder_lookup_does_not_write_through_a_planted_link() { + let system = tempfile::tempdir().unwrap(); + let victim = tempfile::NamedTempFile::new().unwrap(); + std::fs::write(victim.path(), b"keep me").unwrap(); + std::os::unix::fs::symlink(victim.path(), system.path().join(".artcraft-launcher-write-test")).unwrap(); + assert_eq!(mac_applications_dir(system.path(), None), Some(system.path().to_path_buf())); + assert_eq!(std::fs::read(victim.path()).unwrap(), b"keep me"); + } + + #[cfg(not(any(windows, target_os = "macos")))] + #[test] + fn formats_the_system_manages_have_no_single_default_folder() { + let paths = Paths::under(std::path::Path::new("/tmp/scratch")); + assert_eq!(default_folder(PackageKind::Deb, None, &paths), None); + assert_eq!(default_folder(PackageKind::AppImage, None, &paths), None); + } + #[cfg(unix)] #[test] fn msi_install_uses_the_package_target_instead_of_a_symlinked_cache() { diff --git a/crates/native/src/msi_context.rs b/crates/native/src/msi_context.rs index 8d309013..a3b6fc85 100644 --- a/crates/native/src/msi_context.rs +++ b/crates/native/src/msi_context.rs @@ -1,8 +1,6 @@ //! MSI update context is authoritative, not inferred from a display registry entry. //! An existing copy must never fall back to a fresh installation when discovery fails. -use std::path::Path; - use crate::install::MsiScope; const UNKNOWN_CONTEXT: &str = "Windows could not confirm who this app is installed for. No changes were made. Try the app's installer instead."; @@ -55,11 +53,13 @@ pub(crate) fn single_scope(scopes: impl IntoIterator) -> Option scopes.all(|scope| scope == first).then_some(first) } -/// The context for a fresh install. A package that defaults to per-user cannot write to a folder this -/// account has no write access to (a custom folder under Program Files), so that install is machine-wide -/// and Windows asks for permission. Any other fresh install takes the package's own default. -pub(crate) fn fresh_scope(destination: Option<&Path>, writable: impl FnOnce(&Path) -> bool) -> Option { - destination.filter(|folder| !writable(folder)).map(|_| MsiScope::PerMachine) +/// The context to install in. An update keeps `updated`, the context of the copy it replaces. A fresh +/// install (no copy at all) is machine-wide, so every app lands in `C:\Program Files\ArtCraft\` +/// (or the folder the person chose) and not in one account's profile; a dual-scope package would +/// otherwise take its own default, which is per-user. Windows asks for permission once, for that +/// install. Anything else (a copy that is not an MSI) takes the package's own default. +pub(crate) fn install_scope(updated: Option, fresh: bool) -> Option { + updated.or_else(|| fresh.then_some(MsiScope::PerMachine)) } pub(crate) fn valid_product_code(code: &str) -> bool { @@ -138,7 +138,7 @@ mod tests { } #[test] - fn fresh_installs_do_not_probe_or_override_the_package_default() { + fn a_fresh_install_is_not_looked_up() { assert_eq!(update_scope(false, None, |_| Err(ProbeError::Unknown), |_| None), Ok(None)); } @@ -235,10 +235,19 @@ mod tests { } #[test] - fn a_fresh_install_into_a_folder_the_account_cannot_write_is_machine_wide() { - let folder = Path::new(r"C:\Program Files\Custom\PhotoCraft"); - assert_eq!(fresh_scope(Some(folder), |_| false), Some(MsiScope::PerMachine)); - assert_eq!(fresh_scope(Some(folder), |_| true), None); - assert_eq!(fresh_scope(None, |_| panic!("no folder, nothing to test")), None); + fn a_fresh_install_is_machine_wide() { + assert_eq!(install_scope(None, true), Some(MsiScope::PerMachine)); + } + + #[test] + fn an_update_keeps_the_context_of_the_copy_it_replaces() { + for scope in [MsiScope::PerUser, MsiScope::PerMachine] { + assert_eq!(install_scope(Some(scope), false), Some(scope)); + } + } + + #[test] + fn a_copy_that_is_not_an_msi_takes_the_package_default() { + assert_eq!(install_scope(None, false), None); } } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 5a7745db..f25614ee 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -7,7 +7,7 @@ use artcraft_launcher_core::protocol::{ }; use artcraft_launcher_core::release::Release; use artcraft_launcher_core::status::AppStatus; -use artcraft_launcher_core::{Platform, SUITE}; +use artcraft_launcher_core::{Arch, PackageKind, Platform, SUITE}; use crate::i18n::set_current; use crate::model::AppEntry; @@ -61,6 +61,13 @@ pub trait Host { fn pick_folder(&mut self, _initial: Option<&str>) -> Option { None } + /// The folder a new install of this format goes inside when the person hasn't chosen one, so + /// the install-folder field can show that folder instead of only saying "System default". + /// `arch` is the package's architecture when the release names one. `None` when this host + /// has no single answer (the web build; formats the system manages). + fn default_install_folder(&mut self, _kind: PackageKind, _arch: Option) -> Option { + None + } /// The URL to open when Discord is clicked. Defaults to the web link. fn discord_url(&self) -> &'static str { artcraft_launcher_core::catalog::DISCORD_URL diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 17cb4c04..480fc5a5 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -258,8 +258,8 @@ impl LauncherUi { let Some(app) = self.entry(id).map(|e| e.app) else { return true }; ui.set_width(440.0f32.min(ui.ctx().content_rect().width() - 80.0)); Self::title(ui, None, app.name, tl!("Install folder")); - let default = self.settings.install_locations.root.as_deref().unwrap_or(tl!("System default")); - Self::folder_field(ui, folder, Some(default), host); + let default = self.settings.install_locations.root.clone().or_else(|| self.default_folder_for(id, host)); + Self::folder_field(ui, folder, default.as_deref(), host); if self.platform.is_some_and(|p| p.os == Os::Linux) { ui.label(tl!("Custom folders use AppImage on Linux.")); } diff --git a/crates/ui-egui/src/install_target.rs b/crates/ui-egui/src/install_target.rs new file mode 100644 index 00000000..fe02fcff --- /dev/null +++ b/crates/ui-egui/src/install_target.rs @@ -0,0 +1,92 @@ +//! Which package a fresh install would use, so the install-folder fields show the folder that +//! install really goes into. +//! +//! It mirrors the backend's choice (`native::install::choose_kinds`, then `pick_asset`): the +//! preferred formats first, then every other format this platform installs, each tried against +//! every asset token. Choosing only the preferred format would show the portable `apps` folder +//! for a release that ships only an MSI, which the backend then installs into Program Files. +//! The UI cannot see a Linux machine's package managers, so there it answers nothing and the +//! field keeps saying "System default". + +use artcraft_launcher_core::platform::{parse_asset_name, pick_asset}; +use artcraft_launcher_core::protocol::LatestRelease; +use artcraft_launcher_core::{Arch, CraftApp, Os, PackageKind}; + +use crate::app::{Host, LauncherUi}; +use crate::model::AppEntry; + +/// The formats a fresh install can use on `os`, best first: native `available_kinds`. +fn platform_kinds(os: Os) -> &'static [PackageKind] { + match os { + Os::Windows => &[PackageKind::Msi, PackageKind::PortableZip], + Os::MacOs => &[PackageKind::Dmg], + _ => &[], + } +} + +/// The order a fresh install of `app` tries formats in: `preferred` first, then the rest. +fn fresh_kinds(app: &CraftApp, os: Os, preferred: &[PackageKind]) -> Vec { + let available: Vec = platform_kinds(os).iter().copied().filter(|kind| app.installs(*kind)).collect(); + let mut kinds: Vec = preferred.iter().copied().filter(|kind| available.contains(kind)).collect(); + for kind in available { + if !kinds.contains(&kind) { + kinds.push(kind); + } + } + kinds +} + +impl LauncherUi { + /// The format and architecture of the package a fresh install of `entry` would use. Before + /// the release is known, the first format with no architecture (an MSI then answers + /// nothing, as its Program Files depends on it). `None` when nothing installs it here. + fn fresh_package(&self, entry: &AppEntry) -> Option<(PackageKind, Option)> { + let platform = self.platform?; + let kinds = fresh_kinds(entry.app, platform.os, &self.settings.preferred_kinds); + let Some(LatestRelease::Found(release)) = entry.latest.as_ref() else { + return kinds.first().map(|kind| (*kind, None)); + }; + let stems: Vec<&str> = entry.app.stems().collect(); + let (asset, kind) = pick_asset(release, &stems, platform, &kinds)?; + Some((kind, parse_asset_name(&asset.name, &stems).and_then(|name| name.arch()))) + } + + /// The folder a fresh install of `id` goes inside when no folder is chosen. + pub(crate) fn default_folder_for(&self, id: &str, host: &mut dyn Host) -> Option { + let (kind, arch) = self.fresh_package(self.entry(id)?)?; + host.default_install_folder(kind, arch) + } + + /// The default for Settings, which covers every app: the folder when every app that can be + /// installed here shares one, else `None` ("System default"). A 32-bit-only app goes to + /// `Program Files (x86)`, so the launcher's own architecture is not the answer. An app + /// whose release is not known yet cannot be installed, so it does not count. + pub(crate) fn suite_default_folder(&self, host: &mut dyn Host) -> Option { + let mut shared: Option = None; + for entry in self.entries.iter().filter(|entry| matches!(entry.latest, Some(LatestRelease::Found(_)))) { + let Some((kind, arch)) = self.fresh_package(entry) else { continue }; + let folder = host.default_install_folder(kind, arch)?; + match &shared { + Some(seen) if *seen != folder => return None, + Some(_) => {} + None => shared = Some(folder), + } + } + shared + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_fresh_install_tries_the_preferred_format_then_the_rest() { + let app = &artcraft_launcher_core::SUITE[0]; + assert_eq!(fresh_kinds(app, Os::Windows, &[]), [PackageKind::Msi, PackageKind::PortableZip]); + assert_eq!(fresh_kinds(app, Os::Windows, &[PackageKind::PortableZip]), [PackageKind::PortableZip, PackageKind::Msi]); + // A preference this platform cannot install is skipped, as the backend does. + assert_eq!(fresh_kinds(app, Os::Windows, &[PackageKind::Deb]), [PackageKind::Msi, PackageKind::PortableZip]); + assert!(fresh_kinds(app, Os::Linux, &[PackageKind::AppImage]).is_empty()); + } +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index cfc57200..4379c780 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -25,6 +25,7 @@ mod details; mod dialogs; pub mod i18n; pub mod icons; +mod install_target; mod local_time; pub mod model; mod motion; diff --git a/crates/ui-egui/src/settings_dialog.rs b/crates/ui-egui/src/settings_dialog.rs index 10342df7..cc3f5abe 100644 --- a/crates/ui-egui/src/settings_dialog.rs +++ b/crates/ui-egui/src/settings_dialog.rs @@ -203,7 +203,8 @@ impl LauncherUi { sheet::panel(ui, tl!("Default install folder"), |ui| { if self.custom_install_folders() { let mut folder = self.settings.install_locations.root.clone().unwrap_or_default(); - Self::folder_field(ui, &mut folder, None, host); + let default = self.suite_default_folder(host); + Self::folder_field(ui, &mut folder, default.as_deref(), host); self.settings.install_locations.root = (!folder.is_empty()).then_some(folder); note(ui, tl!("New installs use this folder. Updates stay in their current location.")); if self.platform.is_some_and(|p| p.os == Os::Linux) { diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rs index d845470e..bcaad2d6 100644 --- a/crates/ui-egui/tests/ui.rs +++ b/crates/ui-egui/tests/ui.rs @@ -454,6 +454,173 @@ fn use_default_removes_an_app_override_and_settings_can_reset_the_root() { assert_eq!(h.state().as_ref().unwrap().settings.install_locations.root, None); } +/// The install-folder fields' default comes from the host, so a person sees the real folder a +/// fresh install uses (here `/Applications`) instead of only "System default", and a saved root +/// override replaces it. The default is the same value the empty field's hint shows. +#[test] +fn the_install_folder_fields_default_to_the_hosts_answer() { + struct DefaultHost { + picked: Rc>>, + initial: Rc>>>, + } + impl Host for DefaultHost { + fn pick_folder(&mut self, initial: Option<&str>) -> Option { + *self.initial.borrow_mut() = Some(initial.map(str::to_string)); + self.picked.borrow_mut().take() + } + fn default_install_folder(&mut self, _kind: artcraft_launcher_core::PackageKind, _arch: Option) -> Option { + Some("/Applications".into()) + } + } + artcraft_launcher_ui_egui::i18n::set_test_lang(artcraft_launcher_ui_egui::i18n::Lang::EN); + let sent = Rc::new(RefCell::new(Vec::new())); + let mut backend = Some(Fake { + events: vec![ + Event::Latest { app: "photocraft".into(), latest: LatestRelease::Found(release("photocraft", "0.6.0", NOW)), from: Origin::GitHub }, + Event::Detected { app: "photocraft".into(), installed: None }, + ], + sent: sent.clone(), + manage: true, + pictures: Rc::default(), + asked: vec![], + clock: Rc::new(Cell::new(NOW)), + }); + let picked = Rc::new(RefCell::new(None)); + let initial = Rc::new(RefCell::new(None)); + let mut host = DefaultHost { picked: picked.clone(), initial: initial.clone() }; + let harness = test_harness_builder(egui::Theme::Dark).with_size(egui::vec2(1180.0, 900.0)).build_ui_state( + move |ui, state: &mut Option| { + if let Some(backend) = backend.take() { + *state = Some(LauncherUi::new(ui.ctx(), Box::new(backend), Settings { notify: false, ..Default::default() })); + } + if let Some(launcher) = state { + launcher.logic(ui.ctx(), &mut host); + launcher.ui(ui, &mut host); + } + }, + None, + ); + let mut h = harness; + h.run_steps(8); + // Settings' install folder starts at the host's default. + h.get_by_label("Settings").click(); + h.run_steps(4); + h.get_by_label("Browse…").scroll_to_me(); + h.run_steps(4); + h.get_by_label("Browse…").click(); + h.run_steps(3); + assert_eq!(initial.borrow().as_ref(), Some(&Some("/Applications".into()))); + h.get_by_label("Done").click(); + h.run_steps(3); + // So does the per-app install dialog's folder, and a saved root override replaces it. + h.get_by_label("Install").scroll_to_me(); + h.run_steps(3); + h.get_by_label("Install").click(); + h.run_steps(3); + h.get_by_label("Browse…").scroll_to_me(); + h.run_steps(3); + h.get_by_label("Browse…").click(); + h.run_steps(3); + assert_eq!(initial.borrow().as_ref(), Some(&Some("/Applications".into()))); + h.state_mut().as_mut().unwrap().settings.install_locations.root = Some("/Volumes/Craft Apps".into()); + h.run_steps(3); + h.get_by_label("Browse…").click(); + h.run_steps(3); + assert_eq!(initial.borrow().as_ref(), Some(&Some("/Volumes/Craft Apps".into()))); + h.check_accessibility(); +} + +/// A host whose default folder names the package it was asked about (`Msi X86`), and answers +/// nothing when the architecture is unknown, as the desktop host does for an MSI. +/// What Browse was last opened at: `None` until it is clicked. +type BrowsedFrom = Rc>>>; + +struct PackageHost { + initial: BrowsedFrom, +} +impl Host for PackageHost { + fn pick_folder(&mut self, initial: Option<&str>) -> Option { + *self.initial.borrow_mut() = Some(initial.map(str::to_string)); + None + } + fn default_install_folder(&mut self, kind: artcraft_launcher_core::PackageKind, arch: Option) -> Option { + Some(format!("{kind:?} {:?}", arch?)) + } +} + +/// A Windows launcher whose apps publish only the named assets, with `preferred` formats saved. +/// Returns the harness and what Browse was last opened at. +fn windows_package_harness( + apps: &[(&str, &[&str])], + preferred: Vec, +) -> (Harness<'static, Option>, BrowsedFrom) { + artcraft_launcher_ui_egui::i18n::set_test_lang(artcraft_launcher_ui_egui::i18n::Lang::EN); + let mut events = Vec::new(); + for (id, assets) in apps { + let mut latest = release(id, "0.6.0", NOW); + latest.assets = assets.iter().map(|name| Asset { name: (*name).into(), size: 1, url: format!("https://x/{name}"), sha256: None }).collect(); + events.push(Event::Latest { app: (*id).into(), latest: LatestRelease::Found(latest), from: Origin::GitHub }); + events.push(Event::Detected { app: (*id).into(), installed: None }); + } + let fake = Fake { events, sent: Rc::default(), manage: true, pictures: Rc::default(), asked: vec![], clock: Rc::new(Cell::new(NOW)) }; + let mut backend: Option> = Some(Box::new(PlatformFake { inner: fake, platform: Platform { os: Os::Windows, arch: Arch::X64 } })); + let initial = Rc::new(RefCell::new(None)); + let mut host = PackageHost { initial: initial.clone() }; + let harness = test_harness_builder(egui::Theme::Dark).with_size(egui::vec2(1180.0, 900.0)).build_ui_state( + move |ui, state: &mut Option| { + if let Some(backend) = backend.take() { + let settings = Settings { notify: false, preferred_kinds: preferred.clone(), ..Default::default() }; + *state = Some(LauncherUi::new(ui.ctx(), backend, settings)); + } + if let Some(launcher) = state { + launcher.logic(ui.ctx(), &mut host); + launcher.ui(ui, &mut host); + } + }, + None, + ); + (harness, initial) +} + +/// The install dialog's default follows the package the backend will really install: Portable +/// ZIP is preferred, but this release ships only a 32-bit MSI, so the app goes into the 32-bit +/// Program Files and not the launcher's `apps` folder. +#[test] +fn the_install_folder_default_follows_the_package_the_backend_falls_back_to() { + let (mut h, initial) = + windows_package_harness(&[("photocraft", &["photocraft-0.6.0-windows-x86.msi"])], vec![artcraft_launcher_core::PackageKind::PortableZip]); + h.run_steps(8); + h.get_by_label("Install").scroll_to_me(); + h.run_steps(3); + h.get_by_label("Install").click(); + h.run_steps(3); + h.get_by_label("Browse…").click(); + h.run_steps(3); + assert_eq!(initial.borrow().as_ref(), Some(&Some("Msi X86".into()))); +} + +/// Settings covers every app, so it shows a folder only when every app's package shares one: a +/// 32-bit-only app beside a 64-bit one leaves it at "System default". +#[test] +fn settings_shows_a_default_folder_only_when_every_app_shares_it() { + let open_settings_browse = |apps: &[(&str, &[&str])]| { + let (mut h, initial) = windows_package_harness(apps, vec![]); + h.run_steps(8); + h.get_by_label("Settings").click(); + h.run_steps(4); + h.get_by_label("Browse…").scroll_to_me(); + h.run_steps(4); + h.get_by_label("Browse…").click(); + h.run_steps(3); + initial.take() + }; + let x64 = ["photocraft-0.6.0-windows-x64.msi", "photocraft-0.6.0-windows-x86.msi"]; + let shared = open_settings_browse(&[("photocraft", &x64), ("vectorcraft", &["vectorcraft-0.6.0-windows-x64.msi"])]); + assert_eq!(shared, Some(Some("Msi X64".into()))); + let mixed = open_settings_browse(&[("photocraft", &x64), ("vectorcraft", &["vectorcraft-0.6.0-windows-x86.msi"])]); + assert_eq!(mixed, Some(None)); +} + #[cfg(windows)] #[test] fn windows_package_choice_can_select_portable_and_configures_the_backend() {