Enable a flatpak feature (#218)

This commit is contained in:
Philip Kristoffersen
2022-08-31 21:25:35 +02:00
committed by GitHub
parent a1eb34cc56
commit 993bf04a83
4 changed files with 30 additions and 4 deletions
+13
View File
@@ -24,6 +24,19 @@ jobs:
- name: Test - name: Test
run: | run: |
cargo test cargo test
test_Flatpak:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: dependencies
run: |
sudo apt-get update
sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- name: Test
run: |
cargo test --features flatpak
test_Windows: test_Windows:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
+4
View File
@@ -59,3 +59,7 @@ winres = "^0.1.12"
[target."cfg(windows)".dependencies] [target."cfg(windows)".dependencies]
winreg = "^0.10.1" winreg = "^0.10.1"
[features]
# This feature is enabled when building for a flatpak environment
flatpak = []
+3 -1
View File
@@ -22,6 +22,8 @@ finish-args:
- --filesystem=~/Games/Heroic:rw # Heroic (non-flatpak) - --filesystem=~/Games/Heroic:rw # Heroic (non-flatpak)
- --filesystem=~/.var/app/com.heroicgameslauncher.hgl:rw # Heroic (Flatpak) - --filesystem=~/.var/app/com.heroicgameslauncher.hgl:rw # Heroic (Flatpak)
- --filesystem=~/.config/itch:rw # Itch - --filesystem=~/.config/itch:rw # Itch
- --talk-name=org.freedesktop.Flatpak
- --filesystem=xdg-data/flatpak:ro
- --share=network - --share=network
- --share=ipc - --share=ipc
@@ -42,7 +44,7 @@ modules:
- cargo-lock.json - cargo-lock.json
build-commands: build-commands:
- cargo --offline fetch --manifest-path Cargo.toml --verbose - cargo --offline fetch --manifest-path Cargo.toml --verbose
- cargo --offline build --release --verbose - cargo --offline build --release --verbose --features flatpak
- install -Dm755 ./target/release/boilr -t /app/bin/ - install -Dm755 ./target/release/boilr -t /app/bin/
- name: boilr-icon - name: boilr-icon
+9 -2
View File
@@ -54,8 +54,15 @@ impl Platform<LutrisGame, Box<dyn Error>> for LutrisPlatform {
fn get_lutris_command_output(settings: &LutrisSettings) -> Result<String, Box<dyn Error>> { fn get_lutris_command_output(settings: &LutrisSettings) -> Result<String, Box<dyn Error>> {
let output = if settings.flatpak { let output = if settings.flatpak {
let flatpak_image = &settings.flatpak_image; let flatpak_image = &settings.flatpak_image;
let mut command = Command::new("flatpak"); #[cfg(not(feature = "flatpak"))]{
command.arg("run").arg(flatpak_image).arg("-lo").arg("--json").output()? let mut command = Command::new("flatpak");
command.arg("run").arg(flatpak_image).arg("-lo").arg("--json").output()?
}
#[cfg(feature = "flatpak")]
{
let mut command = Command::new("flatpak-spawn");
command.arg("--host").arg("flatpak").arg("run").arg(flatpak_image).arg("-lo").arg("--json").output()?
}
} else { } else {
let mut command = Command::new(&settings.executable); let mut command = Command::new(&settings.executable);
command.arg("-lo").arg("--json").output()? command.arg("-lo").arg("--json").output()?