diff --git a/AM2RLauncher/AM2RLauncher.Gtk/Program.cs b/AM2RLauncher/AM2RLauncher.Gtk/Program.cs index 4138dc9..bfff06f 100644 --- a/AM2RLauncher/AM2RLauncher.Gtk/Program.cs +++ b/AM2RLauncher/AM2RLauncher.Gtk/Program.cs @@ -62,6 +62,14 @@ internal static class MainClass else log.Error("Couldn't determine the currently running distro!"); + if (OS.IsThisRunningFromFlatpak) + log.Info("Running from Flatpak!"); + + #if NOAPPIMAGE + log.Info("On \"No AppImage\" configuration."); + #else + log.Info("On AppImage configuration."); + #endif try { diff --git a/AM2RLauncher/AM2RLauncherLib/OS.cs b/AM2RLauncher/AM2RLauncherLib/OS.cs index 16fd640..cbe8451 100644 --- a/AM2RLauncher/AM2RLauncherLib/OS.cs +++ b/AM2RLauncher/AM2RLauncherLib/OS.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using System.IO; +using System.Runtime.InteropServices; namespace AM2RLauncherLib; @@ -52,6 +53,11 @@ public static class OS /// public static readonly bool IsThisRunningFromWine = CheckIfRunFromWINE(); + /// + /// Checks if this is run via Flatpak. + /// + public static readonly bool IsThisRunningFromFlatpak = CheckIfRunFromFlatpak(); + /// /// Checks if the Launcher is ran from WINE. /// @@ -65,4 +71,18 @@ public static class OS return false; } + + /// + /// Checks if the Launcher is ran from a Flatpak. + /// + /// see langword="true"/> if run from a Flatpak, if not. + private static bool CheckIfRunFromFlatpak() + { + if (!IsLinux) return false; + + // This file is present in all flatpaks + if (File.Exists("/.flatpak-info")) + return true; + return false; + } } \ No newline at end of file