Only load platforms for OS (#288)

* Only load platforms for OS

* Update to version 1.7.10
This commit is contained in:
Philip Kristoffersen
2022-12-28 10:37:11 +01:00
committed by GitHub
parent ffb9b659d5
commit 32c65408a7
5 changed files with 69 additions and 35 deletions
Generated
+1 -1
View File
@@ -265,7 +265,7 @@ dependencies = [
[[package]] [[package]]
name = "boilr" name = "boilr"
version = "1.7.9" version = "1.7.10"
dependencies = [ dependencies = [
"base64 0.20.0", "base64 0.20.0",
"chrono", "chrono",
+2 -4
View File
@@ -1,7 +1,7 @@
[package] [package]
edition = "2021" edition = "2021"
name = "boilr" name = "boilr"
version = "1.7.9" version = "1.7.10"
[dependencies] [dependencies]
base64 = "^0.20.0" base64 = "^0.20.0"
@@ -21,9 +21,6 @@ eyre = "^0.6.8"
color-eyre = "^0.6.2" color-eyre = "^0.6.2"
dyn-clone = "^1.0.10" dyn-clone = "^1.0.10"
[dependencies.sqlite]
version = "^0.30.3"
[dependencies.dashmap] [dependencies.dashmap]
features = ["serde"] features = ["serde"]
version = "^5.4.0" version = "^5.4.0"
@@ -65,6 +62,7 @@ winres = "^0.1.12"
[target."cfg(windows)".dependencies] [target."cfg(windows)".dependencies]
winreg = "^0.10.1" winreg = "^0.10.1"
sqlite = "^0.30.3"
[features] [features]
# This feature is enabled when building for a flatpak environment # This feature is enabled when building for a flatpak environment
+10 -1
View File
@@ -25,7 +25,16 @@ https://hughsie.github.io/oars/index.html
--> -->
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<releases> <releases>
<release version="1.7.9" date="2022-12-28"> <release version="1.7.10" date="2022-12-28">
<description>
<ul>
<li>Only load platforms that are available for OS</li>
</ul>
</description>
</release>
<release version="1.7.9" date="2022-12-28">
<description> <description>
<ul> <ul>
<li>Fix import button hidden on steam deck in game mode</li> <li>Fix import button hidden on steam deck in game mode</li>
+15 -5
View File
@@ -1,18 +1,28 @@
mod amazon; #[cfg(target_family = "unix")]
mod bottles; mod bottles;
mod egs; #[cfg(target_family = "unix")]
mod flatpak; mod flatpak;
mod gog; #[cfg(target_family = "unix")]
mod heroic; mod heroic;
mod itch; #[cfg(target_family = "unix")]
mod legendary; mod legendary;
#[cfg(target_family = "unix")]
mod lutris; mod lutris;
#[cfg(target_family = "unix")]
mod minigalaxy;
#[cfg(not(target_family = "unix"))]
mod amazon;
mod gog;
mod itch;
mod origin; mod origin;
mod platform; mod platform;
mod platforms_load; mod platforms_load;
mod uplay; mod uplay;
mod minigalaxy;
mod egs;
pub(crate) use platform::*; pub(crate) use platform::*;
pub(crate) use gog::get_gog_shortcuts_from_game_folders; pub(crate) use gog::get_gog_shortcuts_from_game_folders;
+41 -24
View File
@@ -1,23 +1,9 @@
use serde::de::DeserializeOwned;
use std::collections::HashMap; use std::collections::HashMap;
use serde::de::DeserializeOwned;
use crate::settings::load_setting_sections;
use super::amazon::AmazonPlatform;
use super::bottles::BottlesPlatform;
use super::egs::EpicPlatform;
use super::flatpak::FlatpakPlatform;
use super::gog::GogPlatform;
use super::heroic::HeroicPlatform;
use super::itch::ItchPlatform;
use super::legendary::LegendaryPlatform;
use super::lutris::LutrisPlatform;
use super::minigalaxy::MiniGalaxyPlatform;
use super::origin::OriginPlatform;
use super::uplay::UplayPlatform;
use super::GamesPlatform; use super::GamesPlatform;
use crate::settings::load_setting_sections;
const PLATFORM_NAMES: [&str; 12] = [ const PLATFORM_NAMES: [&str; 12] = [
"amazon", "amazon",
"bottles", "bottles",
@@ -30,7 +16,7 @@ const PLATFORM_NAMES: [&str; 12] = [
"lutris", "lutris",
"origin", "origin",
"uplay", "uplay",
"minigalaxy" "minigalaxy",
]; ];
pub type Platforms = Vec<Box<dyn GamesPlatform>>; pub type Platforms = Vec<Box<dyn GamesPlatform>>;
@@ -41,19 +27,50 @@ pub fn load_platform<A: AsRef<str>, B: AsRef<str>>(
) -> eyre::Result<Box<dyn GamesPlatform>> { ) -> eyre::Result<Box<dyn GamesPlatform>> {
let name = name.as_ref(); let name = name.as_ref();
let s = settings_string.as_ref(); let s = settings_string.as_ref();
#[cfg(not(target_family = "unix"))]
{
//Windows only platforms
use super::amazon::AmazonPlatform;
match name {
"amazon" => return load::<AmazonPlatform>(s),
_ => {}
}
}
#[cfg(target_family = "unix")]
{
use super::bottles::BottlesPlatform;
use super::flatpak::FlatpakPlatform;
use super::heroic::HeroicPlatform;
use super::legendary::LegendaryPlatform;
use super::lutris::LutrisPlatform;
use super::minigalaxy::MiniGalaxyPlatform;
//Linux only platforms
match name {
"bottles" => return load::<BottlesPlatform>(s),
"flatpak" => return load::<FlatpakPlatform>(s),
"minigalaxy" => return load::<MiniGalaxyPlatform>(s),
"legendary" => return load::<LegendaryPlatform>(s),
"lutris" => return load::<LutrisPlatform>(s),
"heroic" => return load::<HeroicPlatform>(s),
_ => {}
}
}
//Common platforms
use super::egs::EpicPlatform;
use super::gog::GogPlatform;
use super::itch::ItchPlatform;
use super::origin::OriginPlatform;
use super::uplay::UplayPlatform;
match name { match name {
"amazon" => load::<AmazonPlatform>(s),
"bottles" => load::<BottlesPlatform>(s),
"epic_games" => load::<EpicPlatform>(s), "epic_games" => load::<EpicPlatform>(s),
"uplay" => load::<UplayPlatform>(s), "uplay" => load::<UplayPlatform>(s),
"itch" => load::<ItchPlatform>(s), "itch" => load::<ItchPlatform>(s),
"flatpak" => load::<FlatpakPlatform>(s),
"gog" => load::<GogPlatform>(s), "gog" => load::<GogPlatform>(s),
"heroic" => load::<HeroicPlatform>(s),
"legendary" => load::<LegendaryPlatform>(s),
"lutris" => load::<LutrisPlatform>(s),
"origin" => load::<OriginPlatform>(s), "origin" => load::<OriginPlatform>(s),
"minigalaxy" => load::<MiniGalaxyPlatform>(s),
_ => Err(eyre::format_err!("Unknown platform named {name}")), _ => Err(eyre::format_err!("Unknown platform named {name}")),
} }
} }