Skip to content

Commit

Permalink
Find flatpak apps in flatpak mode (#308)
Browse files Browse the repository at this point in the history
* Call flatpak-spawn when in flatpak mode

* Also test flatpak feature on unix

* Update readme with flatpak-flatpak support

* Update to version 1.7.18
  • Loading branch information
PhilipK authored Jan 3, 2023
1 parent 1db73bd commit f1591b7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 10 deletions.
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

0 comments on commit f1591b7

Please sign in to comment.