This commit is contained in:
galister
2026-01-05 20:52:34 +09:00
parent fd9becc398
commit 164e9764eb
22 changed files with 115 additions and 68 deletions

View File

@@ -3,14 +3,13 @@ use std::{path::PathBuf, sync::LazyLock};
const FALLBACK_CACHE_PATH: &str = "/tmp/wayvr_cache";
static CACHE_ROOT_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
if let Some(mut dir) = xdg::BaseDirectories::new().get_cache_home() {
if let Some(mut dir) = xdg::BaseDirectories::new().get_cache_home() {
dir.push("wayvr");
return dir;
}
//Return fallback cache path
log::error!("Err: Failed to find cache path, using {FALLBACK_CACHE_PATH}");
PathBuf::from(FALLBACK_CACHE_PATH) // Panics if neither $XDG_CACHE_HOME nor $HOME is set
PathBuf::from(FALLBACK_CACHE_PATH) // Panics if neither $XDG_CACHE_HOME nor $HOME is set
});
fn get_cache_root() -> PathBuf {