From 396a52da5edaabfd5a24a7c22e38242d6f0ba258 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sat, 18 Nov 2023 15:31:45 -0500 Subject: [PATCH] Use decky-provided settings directory --- backend/Cargo.toml | 2 +- backend/src/utility.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 3fa7e57..7fd5273 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -12,7 +12,7 @@ readme = "../README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -usdpl-back = { version = "0.10.1", features = ["blocking"] }#, path = "../../usdpl-rs/usdpl-back"} +usdpl-back = { version = "0.10.1", features = ["blocking", "decky"] }#, path = "../../usdpl-rs/usdpl-back"} serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" ron = "0.8" diff --git a/backend/src/utility.rs b/backend/src/utility.rs index 62d6909..00dae0b 100644 --- a/backend/src/utility.rs +++ b/backend/src/utility.rs @@ -22,12 +22,19 @@ pub fn ron_pretty_config() -> ron::ser::PrettyConfig { .compact_arrays(true) } -pub fn settings_dir() -> std::path::PathBuf { +#[allow(dead_code)] +pub fn settings_dir_old() -> std::path::PathBuf { usdpl_back::api::dirs::home() .unwrap_or_else(|| "/tmp/".into()) .join(".config/powertools/") } +pub fn settings_dir() -> std::path::PathBuf { + usdpl_back::api::decky::settings_dir() + .unwrap_or_else(|_| "/tmp/".to_owned()) + .into() +} + pub fn chown_settings_dir() -> std::io::Result<()> { let dir = settings_dir(); #[cfg(feature = "decky")]