From 9c7da40f5cbfa8a05896497cb284178e1a6bc1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ne=C3=9Flauer?= Date: Sat, 21 Feb 2026 13:41:10 +0100 Subject: [PATCH] Fix crash on startup with KSA r3646 (#57) KSA r3646 added `Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory)` at the top of Program.Main() to fix a Linux startup crash. When launched via StarMap, AppDomain.CurrentDomain.BaseDirectory resolves to StarMap's directory instead of the game directory, causing the game to look for assets in the wrong location. Fix by setting APP_CONTEXT_BASE_DIRECTORY to the game directory, which is the backing store for AppDomain.CurrentDomain.BaseDirectory in .NET. Fixes #55 --- StarMap.Loader/GameSurveyer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/StarMap.Loader/GameSurveyer.cs b/StarMap.Loader/GameSurveyer.cs index bdd67e8..371a191 100644 --- a/StarMap.Loader/GameSurveyer.cs +++ b/StarMap.Loader/GameSurveyer.cs @@ -40,6 +40,7 @@ public bool TryLoadCoreAndGame() } Directory.SetCurrentDirectory(gameDirectory); + AppContext.SetData("APP_CONTEXT_BASE_DIRECTORY", gameDirectory + Path.DirectorySeparatorChar); _core = core; core.Init();