From d926ee0dbae74d875fa0c9fffabdcf34647fc1be Mon Sep 17 00:00:00 2001 From: HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:33:03 +0700 Subject: [PATCH] [SDLSystem/Win32] Support absolute font paths Problem: On my machine there's an Office font which has an absolute path in its registry key. As such before this fix SDN failed to load because it concatenated this absolute path to the fonts dir, causing a FileNotFoundException on font load. Solution: Added a check for absolute paths to be used as-is, as well as a file exists check to prevent crashes in case of missing font files. --- Source.SDLSystem/SDL3_System.Win32.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source.SDLSystem/SDL3_System.Win32.cs b/Source.SDLSystem/SDL3_System.Win32.cs index 3d384e38..8dfea7be 100644 --- a/Source.SDLSystem/SDL3_System.Win32.cs +++ b/Source.SDLSystem/SDL3_System.Win32.cs @@ -32,7 +32,13 @@ public ReadOnlySpan GetEntryPath(ReadOnlySpan name, int weight, bool foreach (var valueName in baseKey.GetValueNames()) { var value = baseKey.GetValue(valueName); - string absPath = Path.Combine(fontsPath, (string)value!); + string fontFileName = (string)value!; + string absPath = Path.IsPathFullyQualified(fontFileName) ? fontFileName : Path.Combine(fontsPath, fontFileName); + if (!Path.Exists(absPath)) { + Warning("Font '%s' refers to a missing file '%s'\n", valueName, fontFileName); + continue; + } + int i = 0; foreach (var fontfile in GetFontConditions(absPath)) { Entries.Add(new() {