[gnome-games] ui: Add Application.is_running_in_flatpak()
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] ui: Add Application.is_running_in_flatpak()
- Date: Thu, 16 Aug 2018 09:45:33 +0000 (UTC)
commit 13263da5788e4f442eab2970f633d9c516c876dd
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Thu Aug 16 13:53:44 2018 +0500
ui: Add Application.is_running_in_flatpak()
This will be used in the following commits to special-case running host
commands from sandbox.
src/ui/application.vala | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 49896258..b8c317ea 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -3,6 +3,8 @@
public class Games.Application : Gtk.Application {
const string HELP_URI = "https://wiki.gnome.org/Apps/Games/Documentation";
+ private static bool? is_flatpak;
+
private Database database;
private PreferencesWindow preferences_window;
@@ -152,6 +154,17 @@ public class Games.Application : Gtk.Application {
return @"$data_dir/medias";
}
+ public static bool is_running_in_flatpak () {
+ if (is_flatpak != null)
+ return is_flatpak;
+
+ var file = File.new_for_path ("/.flatpak-info");
+
+ is_flatpak = file.query_exists ();
+
+ return is_flatpak;
+ }
+
public void add_game_files () {
add_game_files_async.begin ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]