Find flatpak apps in flatpak mode (#308)

* 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
This commit is contained in:
Philip Kristoffersen
2023-01-03 17:48:13 +01:00
committed by GitHub
parent 1db73bd0e7
commit f1591b7818
6 changed files with 37 additions and 10 deletions
+1
View File
@@ -24,6 +24,7 @@ jobs:
- name: Test - name: Test
run: | run: |
cargo test cargo test
cargo test --features flatpak
test_Windows: test_Windows:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
Generated
+1 -1
View File
@@ -256,7 +256,7 @@ dependencies = [
[[package]] [[package]]
name = "boilr" name = "boilr"
version = "1.7.17" version = "1.7.18"
dependencies = [ dependencies = [
"base64 0.20.0", "base64 0.20.0",
"color-eyre", "color-eyre",
+1 -1
View File
@@ -1,7 +1,7 @@
[package] [package]
edition = "2021" edition = "2021"
name = "boilr" name = "boilr"
version = "1.7.17" version = "1.7.18"
[dependencies] [dependencies]
base64 = "^0.20.0" base64 = "^0.20.0"
+1 -1
View File
@@ -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 | | [Rare](https://github.com/Dummerle/Rare/releases) | No | Yes | Yes |
| [Heroic Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) | No | Yes | Yes | | [Heroic Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) | No | Yes | Yes |
| [Amazon Games](https://gaming.amazon.com) | Yes | No | No | | [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 | | [Bottles](https://usebottles.com/) | No | Yes | Yes |
| [MiniGalaxy](https://sharkwouter.github.io/minigalaxy/) | No | Yes | Yes | | [MiniGalaxy](https://sharkwouter.github.io/minigalaxy/) | No | Yes | Yes |
@@ -26,6 +26,14 @@ 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.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"> <release version="1.7.17" date="2023-01-02">
<description> <description>
<ul> <ul>
+25 -7
View File
@@ -37,13 +37,7 @@ impl NeedsPorton<FlatpakPlatform> for FlatpakApp {
impl FlatpakPlatform { impl FlatpakPlatform {
fn get_flatpak_apps(&self) -> eyre::Result<Vec<FlatpakApp>> { fn get_flatpak_apps(&self) -> eyre::Result<Vec<FlatpakApp>> {
use std::process::Command; let output = get_flatpak_applications()?;
let mut command = Command::new("flatpak");
let output = command
.arg("list")
.arg("--app")
.arg("--columns=name,application")
.output()?;
let output_string = String::from_utf8_lossy(&output.stdout).to_string(); let output_string = String::from_utf8_lossy(&output.stdout).to_string();
let mut result = vec![]; let mut result = vec![];
for line in output_string.lines() { for line in output_string.lines() {
@@ -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 { impl FromSettingsString for FlatpakPlatform {
fn from_settings_string<S: AsRef<str>>(s: S) -> Self { fn from_settings_string<S: AsRef<str>>(s: S) -> Self {
FlatpakPlatform { FlatpakPlatform {