parent
e311f6bdd7
commit
7374877a1b
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ARCHBLOXBootstrapper
|
||||||
|
{
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
|
||||||
|
static extern uint GetModuleFileName(IntPtr hModule, System.Text.StringBuilder lpFilename, int nSize);
|
||||||
|
static readonly int MAX_PATH = 255;
|
||||||
|
public static string GetExecutablePath()
|
||||||
|
{
|
||||||
|
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
var sb = new System.Text.StringBuilder(MAX_PATH);
|
||||||
|
GetModuleFileName(IntPtr.Zero, sb, MAX_PATH);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Form2.cs
2
Form2.cs
|
|
@ -24,7 +24,7 @@ namespace ARCHBLOXBootstrapper
|
||||||
string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\ARCHBLOX Studio.lnk";
|
string shortcutAddress = (string)shell.SpecialFolders.Item(ref shDesktop) + @"\ARCHBLOX Studio.lnk";
|
||||||
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
|
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutAddress);
|
||||||
shortcut.Description = "ARCHBLOX Studio";
|
shortcut.Description = "ARCHBLOX Studio";
|
||||||
shortcut.TargetPath = Path.GetFullPath(Application.ExecutablePath);
|
shortcut.TargetPath = Extensions.GetExecutablePath();
|
||||||
shortcut.Save();
|
shortcut.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue