global: snapshot

This commit is contained in:
nym21
2026-01-16 23:49:49 +01:00
parent 3b00a92fa4
commit 6bb1a2a311
34 changed files with 2600 additions and 5071 deletions
+10 -17
View File
@@ -2,7 +2,6 @@
use std::{
fs,
path::PathBuf,
thread::{self, sleep},
time::Duration,
};
@@ -68,14 +67,17 @@ pub fn run() -> color_eyre::Result<()> {
let data_path = config.brkdir();
let website_source = match config.website() {
Website::Enabled(false) => WebsiteSource::Disabled,
Website::Path(p) => WebsiteSource::Filesystem(p),
Website::Enabled(false) => {
info!("Website: disabled");
WebsiteSource::Disabled
}
Website::Path(p) => {
info!("Website: filesystem ({})", p.display());
WebsiteSource::Filesystem(p)
}
Website::Enabled(true) => {
// Prefer local filesystem if available, otherwise use embedded
match find_local_website_dir() {
Some(path) => WebsiteSource::Filesystem(path),
None => WebsiteSource::Embedded,
}
info!("Website: embedded");
WebsiteSource::Embedded
}
};
@@ -119,12 +121,3 @@ pub fn run() -> color_eyre::Result<()> {
}
}
}
/// Path to website directory relative to this crate (only valid at dev machine)
const DEV_WEBSITE_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../../website");
/// Returns local website path if it exists (dev mode)
fn find_local_website_dir() -> Option<PathBuf> {
let path = PathBuf::from(DEV_WEBSITE_DIR);
path.exists().then_some(path)
}