[gnome-games] steam: Support Steam in Flatpak
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] steam: Support Steam in Flatpak
- Date: Fri, 10 Aug 2018 20:25:52 +0000 (UTC)
commit 441bc12da1f0d176d54fb9411ccf78e78be4b6d6
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Fri Aug 10 03:10:18 2018 +0500
steam: Support Steam in Flatpak
Steam in Flatpak uses a different data directory, and has to be launched
via "flatpak run".
plugins/steam/src/steam-plugin.vala | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/plugins/steam/src/steam-plugin.vala b/plugins/steam/src/steam-plugin.vala
index 383c0c02..f4f1412f 100644
--- a/plugins/steam/src/steam-plugin.vala
+++ b/plugins/steam/src/steam-plugin.vala
@@ -1,7 +1,11 @@
// This file is part of GNOME Games. License: GPL-3.0+.
private class Games.SteamPlugin : Object, Plugin {
+ private const string STEAM_APPID = "com.valvesoftware.Steam";
+ private const string STEAM_FLATPAK_DIR = "/.var/app/" + STEAM_APPID;
+
private const string STEAM_FILE_SCHEME = "steam+file";
+ private const string FLATPAK_STEAM_FILE_SCHEME = "flatpak+steam+file";
private const string PLATFORM_ID = "Steam";
private const string PLATFORM_NAME = _("Steam");
@@ -15,16 +19,23 @@ private class Games.SteamPlugin : Object, Plugin {
// Steam's installation path can be found in its registry.
var home = Environment.get_home_dir ();
+ UriSource[] sources = {};
+
try {
- var source = new SteamUriSource (home, STEAM_FILE_SCHEME);
+ sources += new SteamUriSource (home, STEAM_FILE_SCHEME);
+ }
+ catch (Error e) {
+ debug (e.message);
+ }
- return { source };
+ try {
+ sources += new SteamUriSource (home + STEAM_FLATPAK_DIR, FLATPAK_STEAM_FILE_SCHEME);
}
catch (Error e) {
debug (e.message);
}
- return {};
+ return sources;
}
public UriGameFactory[] get_uri_game_factories () {
@@ -32,13 +43,21 @@ private class Games.SteamPlugin : Object, Plugin {
var factory = new GenericUriGameFactory (game_uri_adapter);
factory.add_scheme (STEAM_FILE_SCHEME);
- return { factory };
+ var game_uri_adapter_flatpak = new GenericGameUriAdapter (game_for_flatpak_steam_uri);
+ var factory_flatpak = new GenericUriGameFactory (game_uri_adapter_flatpak);
+ factory_flatpak.add_scheme (FLATPAK_STEAM_FILE_SCHEME);
+
+ return { factory, factory_flatpak };
}
private static Game game_for_steam_uri (Uri uri) throws Error {
return create_game (uri, "steam", "", { "steam" });
}
+ private static Game game_for_flatpak_steam_uri (Uri uri) throws Error {
+ return create_game (uri, STEAM_APPID, "flatpak", { "flatpak", "run", STEAM_APPID });
+ }
+
private static Game create_game (Uri uri, string app_id, string prefix, string[] command) throws
Error {
var file_uri = new Uri.from_uri_and_scheme (uri, "file");
var file = file_uri.to_file ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]