Browse Source

Fix app path resolution on non - appimage linux builds

pull/55/head
Ionite 1 year ago
parent
commit
d0c884b992
No known key found for this signature in database
  1. 6
      StabilityMatrix.Core/Helper/Compat.cs

6
StabilityMatrix.Core/Helper/Compat.cs

@ -4,6 +4,7 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Semver;
using Sentry.Protocol;
using StabilityMatrix.Core.Models.FileInterfaces;
namespace StabilityMatrix.Core.Helper;
@ -100,9 +101,10 @@ public static class Compat
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Platform = PlatformKind.Linux | PlatformKind.Unix;
// We need to get application path using `$APPIMAGE`, then get the directory name
// For AppImage builds, the path is in `$APPIMAGE`
var appPath = Environment.GetEnvironmentVariable("APPIMAGE") ??
throw new Exception("Could not find application path");
AppContext.BaseDirectory;
AppCurrentDir = Path.GetDirectoryName(appPath) ??
throw new Exception("Could not find application directory");
ExeExtension = "";

Loading…
Cancel
Save