string path = Environment.GetEnvironmentVariable("PATH");
var modPath = string.Empty;
string[] allPaths = path.Split(Path.PathSeparator);
bool pathFound = false;
foreach (string path2 in allPaths)
{
modPath = Path.Combine(path2, array[1]+".exe");
if(File.Exists(modPath))
{
Console.WriteLine($"{array[1]} is {modPath}");
{
pathFound = true;
break;
}
}
}
if (pathFound)
continue;
Console.WriteLine($"{command.Substring(5)}: not found");
When i am removing .exe everything is passing except1
remote: [your-program] my_exe is /tmp/bar/my_exe
remote: [tester::#MG5] ^ Line does not match expected value.
remote: [tester::#MG5] Expected: “my_exe is /tmp/quz/my_exe”
remote: [tester::#MG5] Received: “my_exe is /tmp/bar/my_exe”
so i changed it to exe strict,but its not working for any scenarios
why so
Note that there are multiple files with the same name in different locations, but not all of them are executable. Only the first executable should be picked up.