Launcher v0.2.0 : version dans la barre de titre, version du jeu compilé à côté de « Jeu compilé »
Après chaque compilation, build[_xx]\version.txt reçoit la version du projet (VERSION, sinon git describe), le même fichier que DoubleTroubleRecomp.bat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98f3186e2e
commit
90569fdde6
4 files changed
+28
-4
No files matched your search
Generated
+1
-1
@@ -396,7 +396,7 @@ checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
|
||||
|
||||
[[package]]
|
||||
name = "dtr-launcher"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"eframe",
|
||||
"png",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dtr-launcher"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
description = "Launcher de DoubleTroubleRecomp : choix du jeu, vérifications, compilation, lancement"
|
||||
publish = false
|
||||
|
||||
+11
-2
@@ -229,6 +229,8 @@ struct Checks {
|
||||
/// dossier de compilation de cette version : build\ (FR) ou build_xx\
|
||||
build_dir: PathBuf,
|
||||
built: bool,
|
||||
/// version du projet au moment de la compilation (build[_xx]\version.txt, écrit après chaque compilation)
|
||||
built_version: Option<String>,
|
||||
/// tucker.exe accepte --charger N (moteur assez récent)
|
||||
can_load: bool,
|
||||
}
|
||||
@@ -269,7 +271,10 @@ impl Checks {
|
||||
/// chemin de l'exécutable compilé, relatif au projet (build\tucker.exe, build_en\tucker.exe…)
|
||||
fn exe_label(&self) -> String {
|
||||
let d = self.build_dir.file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "build".into());
|
||||
format!("{d}\\tucker.exe")
|
||||
match &self.built_version {
|
||||
Some(v) if self.built => format!("{d}\\tucker.exe · {v}"),
|
||||
_ => format!("{d}\\tucker.exe"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,6 +415,10 @@ fn run_checks(root: &Path, cfg: &Config) -> Checks {
|
||||
game_error,
|
||||
version,
|
||||
built: build_dir.join("tucker.exe").is_file(),
|
||||
built_version: std::fs::read_to_string(build_dir.join(updates::VERSION_STAMP))
|
||||
.ok()
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty()),
|
||||
can_load: engine_can_load(&build_dir.join("tucker.exe")),
|
||||
build_dir,
|
||||
}
|
||||
@@ -3901,7 +3910,7 @@ fn main() -> eframe::Result {
|
||||
}
|
||||
let options = eframe::NativeOptions {
|
||||
viewport: viewport
|
||||
.with_title("DoubleTroubleRecomp")
|
||||
.with_title(format!("DoubleTroubleRecomp — launcher v{}", env!("CARGO_PKG_VERSION")))
|
||||
.with_inner_size(size)
|
||||
.with_maximized(cfg.maximized)
|
||||
.with_icon(window_icon())
|
||||
|
||||
@@ -24,6 +24,17 @@ pub const LAUNCHER: [&str; 1] = ["launcher"];
|
||||
/// fichier du dossier de compilation qui retient le commit compilé
|
||||
pub const STAMP: &str = "commit.txt";
|
||||
|
||||
/// fichier du dossier de compilation qui retient la version compilée (même fichier que DoubleTroubleRecomp.bat)
|
||||
pub const VERSION_STAMP: &str = "version.txt";
|
||||
|
||||
/// version du projet : fichier VERSION d'une archive de release, sinon `git describe` (clone Git)
|
||||
pub fn project_version(root: &Path) -> String {
|
||||
if let Ok(v) = std::fs::read_to_string(root.join("VERSION")) {
|
||||
return v.trim().to_string();
|
||||
}
|
||||
git(root, &["describe", "--tags", "--always"]).unwrap_or_default()
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct Info {
|
||||
/// le projet est un clone Git (sinon : installé depuis un ZIP, pas de mise à jour automatique)
|
||||
@@ -117,6 +128,10 @@ pub fn stamp_build(root: &Path, build_dir: &Path) {
|
||||
if let Ok(h) = git(root, &["rev-parse", "HEAD"]) {
|
||||
let _ = std::fs::write(build_dir.join(STAMP), h + "\n");
|
||||
}
|
||||
let v = project_version(root);
|
||||
if !v.is_empty() {
|
||||
let _ = std::fs::write(build_dir.join(VERSION_STAMP), v + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user