Merge pull request #392 from CJ-SPT/shortcut-error

Enhancement: Shortcut error
This commit is contained in:
Chomp
2025-06-13 07:59:07 +01:00
committed by GitHub
+16
View File
@@ -18,6 +18,14 @@ public static class Program
{
public static async Task Main(string[] args)
{
// Some users don't know how to create a shortcut...
if (!IsRunFromInstallationFolder())
{
Console.WriteLine("You have not created a shortcut properly. Please hold alt when dragging to create a shortcut.");
await Task.Delay(-1);
return;
}
// Initialize the program variables
ProgramStatics.Initialize();
@@ -156,6 +164,14 @@ public static class Program
}
}
private static bool IsRunFromInstallationFolder()
{
var dirFiles = Directory.GetFiles(Directory.GetCurrentDirectory());
// This file is guaranteed to exist if ran from the correct location, even if the game does not exist here.
return dirFiles.Any(dirFile => dirFile.EndsWith("sptLogger.json"));
}
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr GetStdHandle(int nStdHandle);