use freedesktop instead of gtk

This commit is contained in:
galister
2025-12-27 15:28:16 +09:00
parent 64c8f03dae
commit 43037a6a41
10 changed files with 180 additions and 590 deletions

View File

@@ -1,16 +1,12 @@
use std::{path::PathBuf, sync::LazyLock};
const FALLBACK_CACHE_PATH: &str = "/tmp/wayvr_cache";
use freedesktop::xdg_cache_home;
static CACHE_ROOT_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
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
let mut dir = xdg_cache_home();
dir.push("wayvr");
dir
});
fn get_cache_root() -> PathBuf {