From e808c181c96710d102ec31ef942b156643d87f89 Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Thu, 12 Jun 2025 19:26:13 -0400 Subject: [PATCH] Add error handling for improper shortcut creation... --- SPTarkov.Server/Program.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SPTarkov.Server/Program.cs b/SPTarkov.Server/Program.cs index 4b1bc28d..9ac13704 100644 --- a/SPTarkov.Server/Program.cs +++ b/SPTarkov.Server/Program.cs @@ -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);