launcher: surface env vars even when path is missing on disk

Previously DescribeActive() only returned overrides when the path
resolved, so DORKNET_LOCAL_RELEASES set to a typo'd or unmounted
path would silently fall through to the GitHub fetch and the
Settings panel would stay hidden. Now the panel shows the env
var value with a [SET BUT NOT FOUND on disk] tag when the path
isn't there, so the user can debug 'I set it but it didn't work'
without reading the source.
This commit is contained in:
Alexa
2026-05-27 11:53:40 +03:00
parent 7d1ac82cf8
commit a5f1d74a8e
+16 -6
View File
@@ -66,15 +66,25 @@ public static class LocalOverrides
return Directory.Exists(dir) ? dir : null; return Directory.Exists(dir) ? dir : null;
} }
/// <summary>Single-line description of what overrides are active, /// <summary>Multi-line description of override state, for the
/// for surfacing in the Settings view. Empty string if none.</summary> /// Settings view. Shows env var values even when the path doesn't
/// resolve, so the user can debug "I set DORKNET_LOCAL_RELEASES
/// but it didn't work" without digging into File.Exists.</summary>
public static string DescribeActive() public static string DescribeActive()
{ {
var parts = new List<string>(); var parts = new List<string>();
var m = GetLocalManifestPath(); Describe(ManifestEnvVar, isDir: false, parts);
if (m is not null) parts.Add($"manifest -> {m}"); Describe(ReleasesEnvVar, isDir: true, parts);
var r = GetLocalReleasesRoot();
if (r is not null) parts.Add($"releases -> {r}");
return string.Join("\n", parts); return string.Join("\n", parts);
} }
private static void Describe(string envVar, bool isDir, List<string> parts)
{
var raw = Environment.GetEnvironmentVariable(envVar);
if (string.IsNullOrEmpty(raw)) return;
var exists = isDir ? Directory.Exists(raw) : File.Exists(raw);
parts.Add(exists
? $"{envVar} -> {raw} [active]"
: $"{envVar} -> {raw} [SET BUT NOT FOUND on disk]");
}
} }