diff --git a/Elwig/Helpers/Printing/Pdf.cs b/Elwig/Helpers/Printing/Pdf.cs index 438ae5a..d8091fb 100644 --- a/Elwig/Helpers/Printing/Pdf.cs +++ b/Elwig/Helpers/Printing/Pdf.cs @@ -7,6 +7,7 @@ using System.Drawing.Printing; using System.IO; using System.Linq; using System.Net.Sockets; +using System.Reflection; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -15,11 +16,13 @@ using System.Windows; namespace Elwig.Helpers.Printing { public static class Pdf { - private static readonly string WinziPrint = new string[] { App.InstallPath } - .Union(Environment.GetEnvironmentVariable("PATH")?.Split(';') ?? []) - .Select(x => Path.Combine(x, "WinziPrint.exe")) - .Where(File.Exists) - .FirstOrDefault() ?? throw new FileNotFoundException("WiniPrint executable not found"); + private static readonly string WinziPrint = (Assembly.GetEntryAssembly()?.Location.Contains(@"\bin\") ?? false) ? + Path.Combine(Assembly.GetEntryAssembly()!.Location.Split(@"\bin\")[0], "../Installer/Files/WinziPrint.exe") : + new string[] { App.InstallPath } + .Union(Environment.GetEnvironmentVariable("PATH")?.Split(';') ?? []) + .Select(x => Path.Combine(x, "WinziPrint.exe")) + .Where(File.Exists) + .FirstOrDefault() ?? throw new FileNotFoundException("WiniPrint executable not found"); private static Process? WinziPrintProc; public static bool IsReady => WinziPrintProc != null;