overhaul desktop finder
This commit is contained in:
@@ -7,13 +7,13 @@ edition = "2024"
|
||||
[dependencies]
|
||||
wayvr-ipc = { path = "../wayvr-ipc", default-features = false }
|
||||
|
||||
freedesktop.workspace = true
|
||||
anyhow.workspace = true
|
||||
glam.workspace = true
|
||||
idmap = { workspace = true, features = ["serde"] }
|
||||
idmap-derive.workspace = true
|
||||
log.workspace = true
|
||||
serde = { workspace = true, features = ["rc"] }
|
||||
xdg.workspace = true
|
||||
|
||||
chrono = "0.4.42"
|
||||
smol = "2.0.2"
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
use std::{path::PathBuf, sync::LazyLock};
|
||||
|
||||
use freedesktop::xdg_cache_home;
|
||||
const FALLBACK_CACHE_PATH: &str = "/tmp/wayvr_cache";
|
||||
|
||||
static CACHE_ROOT_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
|
||||
// Panics if neither $XDG_CACHE_HOME nor $HOME is set
|
||||
let mut dir = xdg_cache_home();
|
||||
dir.push("wayvr");
|
||||
dir
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
fn get_cache_root() -> PathBuf {
|
||||
|
||||
Reference in New Issue
Block a user