Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Call flatpak-spawn when in flatpak mode #308

Merged
merged 4 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Test
run: |
cargo test
cargo test --features flatpak
test_Windows:
runs-on: windows-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "boilr"
version = "1.7.17"
version = "1.7.18"

[dependencies]
base64 = "^0.20.0"
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ BoilR can import games from many platforms, but there are limits based
| [Rare](https://github.com/Dummerle/Rare/releases) | No | Yes | Yes |
| [Heroic Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) | No | Yes | Yes |
| [Amazon Games](https://gaming.amazon.com) | Yes | No | No |
| [Flatpaks](https://flathub.org/) | No | Yes | [No](https://github.com/PhilipK/BoilR/issues/184#issuecomment-1192680467) |
| [Flatpaks](https://flathub.org/) | No | Yes | Yes |
| [Bottles](https://usebottles.com/) | No | Yes | Yes |
| [MiniGalaxy](https://sharkwouter.github.io/minigalaxy/) | No | Yes | Yes |

Expand Down
8 changes: 8 additions & 0 deletions flatpak/io.github.philipk.boilr.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ https://hughsie.github.io/oars/index.html
-->
<content_rating type="oars-1.1" />
<releases>
<release version="1.7.18" date="2023-01-03">
<description>
<ul>
<li>Can now find flatpak apps from flatpak version</li>
</ul>
</description>
</release>

<release version="1.7.17" date="2023-01-02">
<description>
<ul>
Expand Down
32 changes: 25 additions & 7 deletions src/platforms/flatpak/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ impl NeedsPorton<FlatpakPlatform> for FlatpakApp {

impl FlatpakPlatform {
fn get_flatpak_apps(&self) -> eyre::Result<Vec<FlatpakApp>> {
use std::process::Command;
let mut command = Command::new("flatpak");
let output = command
.arg("list")
.arg("--app")
.arg("--columns=name,application")
.output()?;
let output = get_flatpak_applications()?;
let output_string = String::from_utf8_lossy(&output.stdout).to_string();
let mut result = vec![];
for line in output_string.lines() {
Expand All @@ -61,6 +55,30 @@ impl FlatpakPlatform {
}
}

fn get_flatpak_applications() -> std::io::Result<std::process::Output> {
use std::process::Command;
#[cfg(not(feature = "flatpak"))]
{
let mut command = Command::new("flatpak");
command
.arg("list")
.arg("--app")
.arg("--columns=name,application")
.output()
}
#[cfg(feature = "flatpak")]
{
let mut command = Command::new("flatpak-spawn");
command
.arg("--host")
.arg("flatpak")
.arg("list")
.arg("--app")
.arg("--columns=name,application")
.output()
}
}

impl FromSettingsString for FlatpakPlatform {
fn from_settings_string<S: AsRef<str>>(s: S) -> Self {
FlatpakPlatform {
Expand Down