Skip to content

Commit 21dcef7

Browse files
Fix crash on startup with KSA r3646 (#57) (#58)
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 Co-authored-by: Maximilian Neßlauer <maximiliannesslauer@gmail.com>
1 parent b11699d commit 21dcef7

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

StarMap.Loader/GameSurveyer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public bool TryLoadCoreAndGame()
4040
}
4141

4242
Directory.SetCurrentDirectory(gameDirectory);
43+
AppContext.SetData("APP_CONTEXT_BASE_DIRECTORY", gameDirectory + Path.DirectorySeparatorChar);
4344

4445
_core = core;
4546
core.Init();

0 commit comments

Comments
 (0)