Log flatpak+appimage configuration

pull/35/head
Miepee 4 years ago
parent 31f96edaf0
commit c5c124e457

@ -62,6 +62,14 @@ internal static class MainClass
else else
log.Error("Couldn't determine the currently running distro!"); 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 try
{ {

@ -1,4 +1,5 @@
using System.Runtime.InteropServices; using System.IO;
using System.Runtime.InteropServices;
namespace AM2RLauncherLib; namespace AM2RLauncherLib;
@ -52,6 +53,11 @@ public static class OS
/// </summary> /// </summary>
public static readonly bool IsThisRunningFromWine = CheckIfRunFromWINE(); public static readonly bool IsThisRunningFromWine = CheckIfRunFromWINE();
/// <summary>
/// Checks if this is run via Flatpak.
/// </summary>
public static readonly bool IsThisRunningFromFlatpak = CheckIfRunFromFlatpak();
/// <summary> /// <summary>
/// Checks if the Launcher is ran from WINE. /// Checks if the Launcher is ran from WINE.
/// </summary> /// </summary>
@ -65,4 +71,18 @@ public static class OS
return false; return false;
} }
/// <summary>
/// Checks if the Launcher is ran from a Flatpak.
/// </summary>
/// <returns>see langword="true"/> if run from a Flatpak, <see langword="false"/> if not.</returns>
private static bool CheckIfRunFromFlatpak()
{
if (!IsLinux) return false;
// This file is present in all flatpaks
if (File.Exists("/.flatpak-info"))
return true;
return false;
}
} }
Loading…
Cancel
Save