Add error handling for improper shortcut creation...

This commit is contained in:
Cj
2025-06-12 19:26:13 -04:00
parent 9c37b79c1d
commit e808c181c9
+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);