From 5c68b550678601a9646e0c44e617069ee16db348 Mon Sep 17 00:00:00 2001 From: pml68 Date: Wed, 26 Feb 2025 23:23:52 +0100 Subject: feat: switch to personal `iced` fork, work on version info --- src/environment.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/environment.rs') diff --git a/src/environment.rs b/src/environment.rs index 1ebb81b..70953a0 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -2,6 +2,16 @@ use std::env; use std::path::PathBuf; pub const CONFIG_FILE_NAME: &str = "config.toml"; +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const GIT_HASH: Option<&str> = option_env!("GIT_HASH"); + +pub fn formatted_version() -> String { + let hash = GIT_HASH + .map(|hash| format!(" ({hash})")) + .unwrap_or_default(); + + format!("{}{hash}", VERSION) +} pub fn config_dir() -> PathBuf { portable_dir().unwrap_or_else(platform_specific_config_dir) -- cgit v1.2.3