diff --git a/src/util/steam_library_folder.rs b/src/util/steam_library_folder.rs index 75af1e2..e9a1b51 100644 --- a/src/util/steam_library_folder.rs +++ b/src/util/steam_library_folder.rs @@ -1,4 +1,4 @@ -use crate::paths::get_home_dir; +use crate::{paths::get_home_dir, xdg::XDG}; use anyhow::bail; use serde::Deserialize; use std::{ @@ -13,16 +13,21 @@ pub struct SteamLibraryFolder { pub apps: HashMap, } -fn get_steam_main_dir_path() -> anyhow::Result { - let steam_root: PathBuf = get_home_dir().join(".steam/root").canonicalize()?; - - if steam_root.is_dir() { +pub fn get_steam_main_dir_path() -> anyhow::Result { + if let Ok(steam_root) = get_home_dir().join(".steam/root").canonicalize() + && steam_root.is_dir() + { + Ok(steam_root) + } else if let Ok(steam_root) = XDG.get_data_home().join("Steam").canonicalize() + && steam_root.is_dir() + { + Ok(steam_root) + } else if let Ok(steam_root) = XDG.get_data_home().join("steam").canonicalize() + && steam_root.is_dir() + { Ok(steam_root) } else { - bail!( - "Canonical steam root '{}' is not a dir nor a symlink!", - steam_root.to_string_lossy() - ) + bail!("Could not find canonical steam root!",) } } diff --git a/src/util/steamvr_utils.rs b/src/util/steamvr_utils.rs index cc05edd..67e3b43 100644 --- a/src/util/steamvr_utils.rs +++ b/src/util/steamvr_utils.rs @@ -1,7 +1,5 @@ -use crate::paths::get_home_dir; +use crate::util::steam_library_folder::get_steam_main_dir_path; pub fn chaperone_info_exists() -> bool { - get_home_dir() - .join(".steam/steam/config/chaperone_info.vrchap") - .is_file() + get_steam_main_dir_path().is_ok_and(|p| p.join("config/chaperone_info.vrchap").is_file()) }