From 561efb340ea1473e1ed1a62e2a28b3c411107571 Mon Sep 17 00:00:00 2001
From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com>
Date: Fri, 16 Oct 2026 00:24:43 +0200
Subject: [PATCH] launcher: say which folders were checked when Minecraft is
not found
Prepare used to stop with "Minecraft 26.3 is not in
. Play 26.3 once from
the official launcher, or choose another folder." followed by an unrelated log
line ("Checking Java and your Minecraft install"). It now lists every folder it
looked in with what each one lacks (no such folder, no versions/26.3/26.3.json,
no 26.3.jar) and the two ways out, one per line. A missing client jar is caught
here too, instead of later inside horizon-prepare.
Only a preparer process's "Exited with ..." gets the last log line appended;
the launcher's own errors are full sentences.
Co-Authored-By: Claude Opus 5.5
---
launcher/src/backend.rs | 72 ++++++++++++++++++++++++++++++++++++++---
launcher/src/main.rs | 12 +++++--
2 files changed, 76 insertions(+), 8 deletions(-)
diff --git a/launcher/src/backend.rs b/launcher/src/backend.rs
index 00c0db163..6e4d9b51b 100644
--- a/launcher/src/backend.rs
+++ b/launcher/src/backend.rs
@@ -644,6 +644,43 @@ fn preparer_binary(dir: &Path) -> Option {
binary.is_file().then_some(binary)
}
+/// What a Minecraft folder lacks of `version`'s files in the official launcher's layout, or
+/// None when it has them.
+fn missing_game_files(minecraft: &Path, version: &str) -> Option {
+ if !minecraft.is_dir() {
+ return Some("the folder doesn't exist".into());
+ }
+ let files = [format!("{version}.json"), format!("{version}.jar")];
+ let missing: Vec = files
+ .iter()
+ .filter(|file| {
+ !minecraft
+ .join("versions")
+ .join(version)
+ .join(file)
+ .is_file()
+ })
+ .map(|file| format!("versions/{version}/{file}"))
+ .collect();
+ (!missing.is_empty()).then(|| format!("no {}", missing.join(" or ")))
+}
+
+/// The error when no folder has Minecraft `version`: every folder looked in with what it
+/// lacks, and what the player can do about it (#419).
+fn not_found(version: &str, checked: &[(PathBuf, String)]) -> String {
+ let mut text = format!("Minecraft {version} was not found. Horizon looked in:");
+ for (dir, missing) in checked {
+ text += &format!("\n {} ({missing})", dir.display());
+ }
+ text += &format!(
+ "\nTo fix it:\n \
+ • Play {version} once in the official Minecraft launcher, then prepare again.\n \
+ • Or choose the folder where your launcher keeps Minecraft {version} (Minecraft folder › \
+ Choose… in the launcher, --minecraft on the command line)."
+ );
+ text
+}
+
/// Checks what the preparation needs and picks how to run it. PLAY.txt describes the same
/// steps: the player's own launcher install, the server jar from that version's own json, and
/// Java (and Python, for versions before horizon-prepare).
@@ -655,11 +692,10 @@ pub fn preparer(tag: &str, minecraft: &Path, log: &dyn Fn(String)) -> Result