From 0480f3857c2861af62b2fdf5c2abddf43594e089 Mon Sep 17 00:00:00 2001 From: Ethan Green Date: Sun, 9 Jul 2023 14:15:39 -0400 Subject: [PATCH 1/3] Add additional Steam search paths for Linux --- src/lib.rs | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7ae9cc1..52142a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -270,21 +270,27 @@ impl SteamDir { // Steam's installation location is pretty easy to find on Linux, too, thanks to the symlink in $USER let home_dir = dirs::home_dir()?; - // Check for Flatpak steam install - let steam_flatpak_path = home_dir.join(".var/app/com.valvesoftware.Steam"); - if steam_flatpak_path.is_dir() { - let steam_flatpak_install_path = steam_flatpak_path.join(".steam/steam"); - if steam_flatpak_install_path.is_dir() { - return Some(steam_flatpak_install_path); - } - } + let steam_paths = vec![ + // Flatpak steam install directories + home_dir.join(".var/app/com.valvesoftware.Steam/.local/share/Steam"), + home_dir.join(".var/app/com.valvesoftware.Steam/.steam/steam"), + home_dir.join(".var/app/com.valvesoftware.Steam/.steam/root"), - // Check for Standard steam install - let standard_path = home_dir.join(".steam/steam"); - if standard_path.is_dir() { - return Some(standard_path); - } + // Standard install directories + home_dir.join(".local/share/Steam"), + home_dir.join(".steam/steam"), + home_dir.join(".steam/root"), + home_dir.join(".steam"), + ]; - None + match steam_paths + .into_iter() + .find(|x| x.is_dir()) { + Some(path) => Some(SteamDir { + path, + ..Default::default() + }), + None => None, + } } } From 3dac0f624edb23a5f325b8f1ec03d89c54a4c550 Mon Sep 17 00:00:00 2001 From: Ethan Green Date: Sun, 9 Jul 2023 14:43:02 -0400 Subject: [PATCH 2/3] Fix invalid return type for locate_steam_dir --- src/lib.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 52142a9..4a049a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -283,14 +283,8 @@ impl SteamDir { home_dir.join(".steam"), ]; - match steam_paths + steam_paths .into_iter() - .find(|x| x.is_dir()) { - Some(path) => Some(SteamDir { - path, - ..Default::default() - }), - None => None, - } + .find(|x| x.is_dir()) } } From b02916d1c7dc94d6ef618d86be4ee7a1caf9e53f Mon Sep 17 00:00:00 2001 From: Ethan Green Date: Sun, 9 Jul 2023 15:02:43 -0400 Subject: [PATCH 3/3] Fix formatting-related CI fail --- src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4a049a1..d840e0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -275,7 +275,6 @@ impl SteamDir { home_dir.join(".var/app/com.valvesoftware.Steam/.local/share/Steam"), home_dir.join(".var/app/com.valvesoftware.Steam/.steam/steam"), home_dir.join(".var/app/com.valvesoftware.Steam/.steam/root"), - // Standard install directories home_dir.join(".local/share/Steam"), home_dir.join(".steam/steam"), @@ -283,8 +282,6 @@ impl SteamDir { home_dir.join(".steam"), ]; - steam_paths - .into_iter() - .find(|x| x.is_dir()) + steam_paths.into_iter().find(|x| x.is_dir()) } }