make GetProcessExecuteable obsolete
-> use Environment.GetProcessPath instead
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
using Pilz.Runtime;
|
||||
using Pilz.Win32.Native;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Pilz.Win32;
|
||||
|
||||
public static class NativeTools
|
||||
{
|
||||
static readonly int MAX_PATH = 255;
|
||||
|
||||
[Obsolete("Use \"Environment.ProcessPath\" instead.")]
|
||||
public static string GetExecutablePath(bool checkRealOS = false)
|
||||
{
|
||||
if (RuntimeInformationsEx.IsOSPlatform(OSType.Windows, checkRealOS))
|
||||
{
|
||||
var sb = new StringBuilder(MAX_PATH);
|
||||
Kernel32.GetModuleFileName(IntPtr.Zero, sb, MAX_PATH);
|
||||
return sb.ToString();
|
||||
}
|
||||
return Environment.ProcessPath; //Process.GetCurrentProcess().MainModule.FileName;
|
||||
return Environment.ProcessPath;
|
||||
return Process.GetCurrentProcess().MainModule.FileName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user