fix: allow optional Preview automation paths

This commit is contained in:
codex
2026-08-04 12:29:37 +03:00
parent 0052790a2b
commit 0829e5dace
3 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -35,7 +35,12 @@ public sealed class PathResolver(IReadOnlyDictionary<string, string?>? environme
public ResolvedLauncherPaths Resolve(LauncherPathVariables variables, IEnumerable<string>? required = null)
{
var resolved = new Dictionary<string, string?>(StringComparer.OrdinalIgnoreCase);
foreach (var name in variables.Values.Keys) resolved[name] = ResolveVariable(name, variables, resolved, []);
// Explicit null values represent optional paths (for example the Apply
// permit during Preview). They are retained as null rather than being
// treated as an unknown variable; required values are still enforced
// below.
foreach (var name in variables.Values.Keys)
resolved[name] = variables[name] is null ? null : ResolveVariable(name, variables, resolved, []);
foreach (var name in resolved.Keys.ToArray())
if (resolved[name] is { } value && value.StartsWith("A:\\", StringComparison.OrdinalIgnoreCase))
{