Skip to content

Commit 32c6540

Browse files
authored
Only load platforms for OS (#288)
* Only load platforms for OS * Update to version 1.7.10
1 parent ffb9b65 commit 32c6540

File tree

5 files changed

+69
-35
lines changed

5 files changed

+69
-35
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "boilr"
4-
version = "1.7.9"
4+
version = "1.7.10"
55

66
[dependencies]
77
base64 = "^0.20.0"
@@ -21,9 +21,6 @@ eyre = "^0.6.8"
2121
color-eyre = "^0.6.2"
2222
dyn-clone = "^1.0.10"
2323

24-
[dependencies.sqlite]
25-
version = "^0.30.3"
26-
2724
[dependencies.dashmap]
2825
features = ["serde"]
2926
version = "^5.4.0"
@@ -65,6 +62,7 @@ winres = "^0.1.12"
6562

6663
[target."cfg(windows)".dependencies]
6764
winreg = "^0.10.1"
65+
sqlite = "^0.30.3"
6866

6967
[features]
7068
# This feature is enabled when building for a flatpak environment

flatpak/io.github.philipk.boilr.appdata.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ https://hughsie.github.io/oars/index.html
2525
-->
2626
<content_rating type="oars-1.1" />
2727
<releases>
28-
<release version="1.7.9" date="2022-12-28">
28+
<release version="1.7.10" date="2022-12-28">
29+
<description>
30+
<ul>
31+
<li>Only load platforms that are available for OS</li>
32+
</ul>
33+
</description>
34+
</release>
35+
36+
37+
<release version="1.7.9" date="2022-12-28">
2938
<description>
3039
<ul>
3140
<li>Fix import button hidden on steam deck in game mode</li>

src/platforms/mod.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
mod amazon;
1+
#[cfg(target_family = "unix")]
22
mod bottles;
3-
mod egs;
3+
#[cfg(target_family = "unix")]
44
mod flatpak;
5-
mod gog;
5+
#[cfg(target_family = "unix")]
66
mod heroic;
7-
mod itch;
7+
#[cfg(target_family = "unix")]
88
mod legendary;
9+
#[cfg(target_family = "unix")]
910
mod lutris;
11+
#[cfg(target_family = "unix")]
12+
mod minigalaxy;
13+
14+
#[cfg(not(target_family = "unix"))]
15+
mod amazon;
16+
17+
18+
mod gog;
19+
mod itch;
1020
mod origin;
1121
mod platform;
1222
mod platforms_load;
1323
mod uplay;
14-
mod minigalaxy;
1524

25+
mod egs;
1626
pub(crate) use platform::*;
1727

1828
pub(crate) use gog::get_gog_shortcuts_from_game_folders;

src/platforms/platforms_load.rs

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
1-
use std::collections::HashMap;
2-
31
use serde::de::DeserializeOwned;
2+
use std::collections::HashMap;
43

5-
use crate::settings::load_setting_sections;
6-
7-
use super::amazon::AmazonPlatform;
8-
use super::bottles::BottlesPlatform;
9-
use super::egs::EpicPlatform;
10-
use super::flatpak::FlatpakPlatform;
11-
use super::gog::GogPlatform;
12-
use super::heroic::HeroicPlatform;
13-
use super::itch::ItchPlatform;
14-
use super::legendary::LegendaryPlatform;
15-
use super::lutris::LutrisPlatform;
16-
use super::minigalaxy::MiniGalaxyPlatform;
17-
use super::origin::OriginPlatform;
18-
use super::uplay::UplayPlatform;
194
use super::GamesPlatform;
205

6+
use crate::settings::load_setting_sections;
217
const PLATFORM_NAMES: [&str; 12] = [
228
"amazon",
239
"bottles",
@@ -30,7 +16,7 @@ const PLATFORM_NAMES: [&str; 12] = [
3016
"lutris",
3117
"origin",
3218
"uplay",
33-
"minigalaxy"
19+
"minigalaxy",
3420
];
3521

3622
pub type Platforms = Vec<Box<dyn GamesPlatform>>;
@@ -41,19 +27,50 @@ pub fn load_platform<A: AsRef<str>, B: AsRef<str>>(
4127
) -> eyre::Result<Box<dyn GamesPlatform>> {
4228
let name = name.as_ref();
4329
let s = settings_string.as_ref();
30+
31+
#[cfg(not(target_family = "unix"))]
32+
{
33+
//Windows only platforms
34+
use super::amazon::AmazonPlatform;
35+
match name {
36+
"amazon" => return load::<AmazonPlatform>(s),
37+
_ => {}
38+
}
39+
}
40+
41+
#[cfg(target_family = "unix")]
42+
{
43+
use super::bottles::BottlesPlatform;
44+
use super::flatpak::FlatpakPlatform;
45+
use super::heroic::HeroicPlatform;
46+
use super::legendary::LegendaryPlatform;
47+
use super::lutris::LutrisPlatform;
48+
use super::minigalaxy::MiniGalaxyPlatform;
49+
//Linux only platforms
50+
match name {
51+
"bottles" => return load::<BottlesPlatform>(s),
52+
"flatpak" => return load::<FlatpakPlatform>(s),
53+
"minigalaxy" => return load::<MiniGalaxyPlatform>(s),
54+
"legendary" => return load::<LegendaryPlatform>(s),
55+
"lutris" => return load::<LutrisPlatform>(s),
56+
"heroic" => return load::<HeroicPlatform>(s),
57+
_ => {}
58+
}
59+
}
60+
61+
//Common platforms
62+
use super::egs::EpicPlatform;
63+
use super::gog::GogPlatform;
64+
use super::itch::ItchPlatform;
65+
use super::origin::OriginPlatform;
66+
use super::uplay::UplayPlatform;
67+
4468
match name {
45-
"amazon" => load::<AmazonPlatform>(s),
46-
"bottles" => load::<BottlesPlatform>(s),
4769
"epic_games" => load::<EpicPlatform>(s),
4870
"uplay" => load::<UplayPlatform>(s),
4971
"itch" => load::<ItchPlatform>(s),
50-
"flatpak" => load::<FlatpakPlatform>(s),
5172
"gog" => load::<GogPlatform>(s),
52-
"heroic" => load::<HeroicPlatform>(s),
53-
"legendary" => load::<LegendaryPlatform>(s),
54-
"lutris" => load::<LutrisPlatform>(s),
5573
"origin" => load::<OriginPlatform>(s),
56-
"minigalaxy" => load::<MiniGalaxyPlatform>(s),
5774
_ => Err(eyre::format_err!("Unknown platform named {name}")),
5875
}
5976
}

0 commit comments

Comments
 (0)