public string GetCommandPathFromRootPath(string rootPath, string commandName, params string[] extensions) { if (!extensions.Any()) { extensions = ExecutableExtensions.ToArray(); } var commandPath = extensions.Select(e => Path.Combine(rootPath, commandName + e)) .FirstOrDefault(File.Exists); return(commandPath); }
public string GetCommandPath(string commandName, params string[] extensions) { if (!extensions.Any()) { extensions = ExecutableExtensions.ToArray(); } var commandPath = SearchPaths.Join( extensions, p => true, s => true, (p, s) => Path.Combine(p, commandName + s)) .FirstOrDefault(File.Exists); return(commandPath); }