summaryrefslogtreecommitdiff
path: root/src/environment.rs
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-02-26 23:23:52 +0100
committerpml68 <contact@pml68.dev>2025-02-26 23:23:52 +0100
commit5c68b550678601a9646e0c44e617069ee16db348 (patch)
treea68d0d1ae29625182b0668d648a8ade0b307ea03 /src/environment.rs
parentfeat: implement `ValueFromStr` for Rotation (diff)
downloadiced-builder-5c68b550678601a9646e0c44e617069ee16db348.tar.gz
feat: switch to personal `iced` fork, work on version info
Diffstat (limited to 'src/environment.rs')
-rw-r--r--src/environment.rs10
1 files changed, 10 insertions, 0 deletions
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)