This commit is contained in:
Mike Dilger 2022-12-21 01:58:39 +13:00
parent 7b8490c5f2
commit 79ddb6f626
2 changed files with 35 additions and 0 deletions

34
src/about.rs Normal file
View File

@ -0,0 +1,34 @@
#[derive(Debug)]
pub struct About {
pub name: String,
pub version: String,
pub description: String,
pub authors: String,
pub repository: String,
pub homepage: String,
pub license: String,
pub database_path: String,
}
#[allow(dead_code)]
pub fn about() -> About {
let data_dir = match dirs::data_dir() {
Some(mut d) => {
d.push("gossip");
d.push("gossip.sqlite");
format!("{}", d.display())
}
None => "Cannot find a directory to store application data.".to_owned(),
};
About {
name: env!("CARGO_PKG_NAME").to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
description: env!("CARGO_PKG_DESCRIPTION").to_string(),
authors: env!("CARGO_PKG_AUTHORS").to_string(),
repository: env!("CARGO_PKG_REPOSITORY").to_string(),
homepage: env!("CARGO_PKG_HOMEPAGE").to_string(),
license: env!("CARGO_PKG_LICENSE").to_string(),
database_path: data_dir,
}
}

View File

@ -3,6 +3,7 @@
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
mod about;
mod comms; mod comms;
mod db; mod db;
mod error; mod error;