summaryrefslogtreecommitdiff
path: root/src/environment.rs
diff options
context:
space:
mode:
authorPolesznyák Márk László <116908301+pml68@users.noreply.github.com>2025-03-23 02:49:57 +0100
committerGitHub <noreply@github.com>2025-03-23 02:49:57 +0100
commit3076889c00116b22f022792471253e7188c6e93e (patch)
treebff0cda7a9152e9f94d3176bbf5acaf879394f5f /src/environment.rs
parentfeat: update to Rust 2024 (diff)
parentfeat: finish `ApplyOptions` impls (diff)
downloadiced-builder-3076889c00116b22f022792471253e7188c6e93e.tar.gz
Merge pull request #7 from pml68/feat/options-backend
Options backend done (for now)
Diffstat (limited to 'src/environment.rs')
-rw-r--r--src/environment.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/environment.rs b/src/environment.rs
index 1ebb81b..8efc425 100644
--- a/src/environment.rs
+++ b/src/environment.rs
@@ -1,7 +1,20 @@
+// (c) 2023-2025 Cory Forsstrom, Casper Rogild Storm
+// (c) 2024-2025 Polesznyák Márk László
+
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)