static string GetExecutablePath(string dir, string exe) { if (string.IsNullOrEmpty(dir)) { return(exe); } foreach (var e in ProcessUtils.ExecutableFiles(exe)) { if (File.Exists(Path.Combine(dir, e))) { return(e); } } return(exe); }
static string GetExecutablePath(string?dir, string exe) { if (string.IsNullOrEmpty(dir)) { return(exe); } foreach (var e in ProcessUtils.ExecutableFiles(exe)) { try { if (File.Exists(Path.Combine(dir, e))) { return(e); } } catch (ArgumentException) { continue; } } return(exe); }