34 lines
1.1 KiB
Rust
34 lines
1.1 KiB
Rust
use std::env::current_exe;
|
|
use std::path::PathBuf;
|
|
|
|
use lazy_static::lazy_static;
|
|
use shadow_rs::{is_debug, shadow};
|
|
|
|
shadow!(build);
|
|
|
|
lazy_static! {
|
|
pub static ref RESOURCE_PATH: PathBuf = if is_debug() {
|
|
let project_root = build::CARGO_MANIFEST_DIR.parse::<PathBuf>().unwrap();
|
|
project_root.join("./tmp/resources")
|
|
} else {
|
|
current_exe()
|
|
.unwrap()
|
|
.parent()
|
|
.unwrap()
|
|
.join("../share/upend")
|
|
};
|
|
pub static ref WEBUI_PATH: PathBuf = RESOURCE_PATH.join("webui");
|
|
static ref APP_USER_AGENT: String = format!("upend / {}", build::PKG_VERSION);
|
|
pub static ref REQWEST_CLIENT: reqwest::blocking::Client = reqwest::blocking::Client::builder()
|
|
.user_agent(APP_USER_AGENT.as_str())
|
|
.build()
|
|
.unwrap();
|
|
pub static ref REQWEST_ASYNC_CLIENT: reqwest::Client = reqwest::Client::builder()
|
|
.user_agent(APP_USER_AGENT.as_str())
|
|
.build()
|
|
.unwrap();
|
|
}
|
|
|
|
pub fn get_version() -> &'static str {
|
|
option_env!("UPEND_VERSION").unwrap_or("unknown")
|
|
}
|