Launcher: run the game from the saves folder, never a version folder
The client ran in the version's own folder, so saves and options.txt would have landed there and been deleted with the version, and the saves in ~/.local/share/horizon (where the release folders' horizon.sh keeps them) were not seen. It now runs in HORIZON_HOME, else horizon in the platform's data folder, with --resources pointing at the version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Generated
+1
-1
@@ -2565,7 +2565,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "horizon-launcher"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"dirs 5.0.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "horizon-launcher"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "Downloads, prepares and starts Horizon builds"
|
||||
|
||||
+13
-1
@@ -336,9 +336,21 @@ pub fn prepare_command(tag: &str, minecraft: &Path, log: &dyn Fn(String)) -> Res
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
/// Where the game keeps saves and options.txt: `HORIZON_HOME`, else `horizon` in the platform's
|
||||
/// data folder (~/.local/share/horizon on Linux, as the release folders' horizon.sh uses). It is
|
||||
/// never inside a version folder, so installing, updating or removing a version keeps the saves.
|
||||
pub fn game_home() -> PathBuf {
|
||||
if let Some(home) = std::env::var_os("HORIZON_HOME").filter(|h| !h.is_empty()) {
|
||||
return PathBuf::from(home);
|
||||
}
|
||||
dirs::data_dir().unwrap_or_else(std::env::temp_dir).join("horizon")
|
||||
}
|
||||
|
||||
pub fn client_command(tag: &str) -> Command {
|
||||
let home = game_home();
|
||||
let _ = fs::create_dir_all(&home);
|
||||
let mut cmd = Command::new(version_dir(tag).join(CLIENT));
|
||||
cmd.current_dir(version_dir(tag));
|
||||
cmd.current_dir(home).arg("--resources").arg(resources(tag));
|
||||
cmd
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user