Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add additional Steam search paths for Linux #31

Merged
merged 3 commits into from
Jul 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,21 +270,18 @@ 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);
}
}

// Check for Standard steam install
let standard_path = home_dir.join(".steam/steam");
if standard_path.is_dir() {
return Some(standard_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"),
// Standard install directories
home_dir.join(".local/share/Steam"),
home_dir.join(".steam/steam"),
home_dir.join(".steam/root"),
home_dir.join(".steam"),
];

None
steam_paths.into_iter().find(|x| x.is_dir())
}
}