From c6405610008b0c779ffe281a6cdab34c67f9199a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:56:26 +0100 Subject: [PATCH 1/2] Launcher: the registry pack tests build file URLs with forward slashes, so they pass on Windows A Windows temp path's backslashes went into the test index's JSON as escapes, so the index failed to parse and the Windows launcher release stopped at its tests. Co-Authored-By: Claude Opus 5.5 --- launcher/src/browser/horizon/pack.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/launcher/src/browser/horizon/pack.rs b/launcher/src/browser/horizon/pack.rs index 73dcd0cc1..a2cc4d079 100644 --- a/launcher/src/browser/horizon/pack.rs +++ b/launcher/src/browser/horizon/pack.rs @@ -208,6 +208,8 @@ mod tests { zip.write_all(b"renderDistance:8\n").unwrap(); zip.finish().unwrap(); let size = |p: &Path| fs::metadata(p).unwrap().len(); + // Forward slashes: a Windows path's backslashes would be escapes in the JSON. + let url = |p: &Path| p.display().to_string().replace('\\', "/"); let text = format!( r#"{{"schema": 1, "projects": [ {{"id": "coords_hud", "kind": "mod", "name": "Coordinates HUD", "summary": "", "license": "MIT", @@ -219,9 +221,9 @@ mod tests { "requires": [{{"id": "coords_hud", "version": "0.1.0", "sha256": "{hmod_sha}"}}], "file": {{"name": "cozy-1.0.0.hpack", "url": "file://{}", "size": {}, "sha256": "{}"}}}}]}} ]{extra}}}"#, - hmod.display(), + url(&hmod), size(&hmod), - hpack.display(), + url(&hpack), size(&hpack), idx::sha256_file(&hpack).unwrap() ); From d41a3075aa86491e6ac23821480ff2a86b494289 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 17:13:26 +0100 Subject: [PATCH 2/2] Launcher: a local registry's file:/// URLs open on Windows file:///C:/x left /C:/x after the scheme, which Windows can't open; the pack tests now write real file:/// URLs (the index only accepts those), with forward slashes. Co-Authored-By: Claude Opus 5.5 --- launcher/src/browser/horizon.rs | 9 +++++++++ launcher/src/browser/horizon/pack.rs | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/launcher/src/browser/horizon.rs b/launcher/src/browser/horizon.rs index e56f31e09..66553ab50 100644 --- a/launcher/src/browser/horizon.rs +++ b/launcher/src/browser/horizon.rs @@ -343,6 +343,7 @@ fn fetch( ) -> Result { match file.url.strip_prefix("file://").filter(|_| local) { Some(path) => { + let path = local_path(path); let reader = fs::File::open(path).map_err(|e| format!("{path}: {e}"))?; download::save_from_anywhere(file, reader, folder, progress) } @@ -350,6 +351,14 @@ fn fetch( } } +/// The path of a `file:///` URL: on Windows `/C:/x` is `C:/x`. +fn local_path(path: &str) -> &str { + match path.strip_prefix('/') { + Some(rest) if cfg!(windows) && rest.get(1..2) == Some(":") => rest, + _ => path, + } +} + /// What the registry adds to an installed entry. fn trust_label(trust: Trust) -> &'static str { match trust { diff --git a/launcher/src/browser/horizon/pack.rs b/launcher/src/browser/horizon/pack.rs index a2cc4d079..3cb6d7c9b 100644 --- a/launcher/src/browser/horizon/pack.rs +++ b/launcher/src/browser/horizon/pack.rs @@ -208,8 +208,16 @@ mod tests { zip.write_all(b"renderDistance:8\n").unwrap(); zip.finish().unwrap(); let size = |p: &Path| fs::metadata(p).unwrap().len(); - // Forward slashes: a Windows path's backslashes would be escapes in the JSON. - let url = |p: &Path| p.display().to_string().replace('\\', "/"); + // A `file:///` URL: forward slashes (a Windows path's backslashes would be escapes in + // the JSON) and a leading slash before a Windows drive. + let url = |p: &Path| { + let path = p.display().to_string().replace('\\', "/"); + if path.starts_with('/') { + path + } else { + format!("/{path}") + } + }; let text = format!( r#"{{"schema": 1, "projects": [ {{"id": "coords_hud", "kind": "mod", "name": "Coordinates HUD", "summary": "", "license": "MIT",