ApprovalUtilities.Utilities.PathUtilities.FindProgramOnPath C# (CSharp) Method

FindProgramOnPath() private static method

private static FindProgramOnPath ( string programName ) : IEnumerable
programName string
return IEnumerable
        private static IEnumerable<string> FindProgramOnPath(string programName)
        {
            if (EnvironmentPaths == null)
            {
                EnvironmentPaths = Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator).ToList();
                if (OsUtils.IsUnixOs())
                {
                    // not sure why this path is not included in the environment variables
                    // but couldn't find find p4merge without it.
                    EnvironmentPaths.Add("/usr/local/bin");
                }
            }
            return EnvironmentPaths.Select(path => Path.Combine(path, programName)).Where(File.Exists);
        }
    }