25 lines
821 B
Rust
25 lines
821 B
Rust
//! Application-level constants (name, version, debug flag, window title).
|
|
|
|
use std::env;
|
|
|
|
pub const APP_NAME: &str = "Curator";
|
|
|
|
/// The project version — `Cargo.toml` is the single source of truth.
|
|
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
|
|
/// Default main-window size when no geometry has been saved yet.
|
|
pub const DEFAULT_WINDOW_SIZE: (f32, f32) = (1200.0, 800.0);
|
|
|
|
/// True when `ENV_DEBUG` is set to a truthy value (`true` / `1` / `yes`).
|
|
pub fn debug_mode() -> bool {
|
|
env::var("ENV_DEBUG")
|
|
.map(|v| matches!(v.to_lowercase().as_str(), "true" | "1" | "yes"))
|
|
.unwrap_or(false)
|
|
}
|
|
|
|
/// `Curator v1.2.3`, with a `-DEV` suffix in debug mode.
|
|
pub fn app_title() -> String {
|
|
let suffix = if debug_mode() { "-DEV" } else { "" };
|
|
format!("{APP_NAME} v{APP_VERSION}{suffix}")
|
|
}
|