Skip to content

Commit 472e40a

Browse files
committed
Explicitly handled case when param executable is already a rooted path
closes #8
1 parent 2cdc2fa commit 472e40a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

FindExecutable/FindExecutable.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ public static class FindExecutable
7070
bool includeBaseDirectory = false,
7171
IEnumerable<string>? additionalPaths = null)
7272
{
73+
if (Path.IsPathRooted(executable))
74+
{
75+
if (File.Exists(executable) && IsExecutable(executable))
76+
{
77+
return executable;
78+
}
79+
return null;
80+
}
81+
7382
IEnumerable<string> paths = Environment.GetEnvironmentVariable("PATH")?.Split(Path.PathSeparator) ?? Array.Empty<string>();
7483
if (includeCurrentDirectory)
7584
{

0 commit comments

Comments
 (0)