chore: tidy up windows path resolution syntax #4

Merged
louis9902 merged 1 commit from feature/tidyup_path_resolution into main 2026-08-25 17:54:51 +00:00

View file

@ -75,15 +75,11 @@ public sealed partial class Command
return TargetFilePath;
}
return (
from probeDirPath in GetProbeDirectoryPaths()
where Directory.Exists(probeDirPath)
select Path.Combine(probeDirPath, TargetFilePath)
into baseFilePath
from extension in GetPathExtensions()
select Path.ChangeExtension(baseFilePath, extension)
).FirstOrDefault(File.Exists) ??
TargetFilePath;
return GetProbeDirectoryPaths()
.Where(Directory.Exists)
.Select(path => Path.Combine(path, TargetFilePath))
.SelectMany(static _ => GetPathExtensions(), static (path, extension) => Path.ChangeExtension(path, extension))
.FirstOrDefault(File.Exists) ?? TargetFilePath;
static IEnumerable<string> GetProbeDirectoryPaths()
{