Example #1
0
        private static string FindCMake()
        {
            var methods = new Func <string>[]
            {
                () => PathUtils.Which("cmake"),
                () => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? PathUtils.GuessPath(new string[] {
                    "%ProgramW6432%\\CMake\\bin\\cmake.exe",
                    "%ProgramFiles%\\CMake\\bin\\cmake.exe",
                    "%ProgramFiles(x86)%\\CMake\\bin\\cmake.exe"
                }) : null,
                () => PathUtils.GuessPath(VsInstances.GetAll().Select(x => Path.Combine(x.InstallationPath, "Common7", "IDE", "CommonExtensions", "Microsoft", "CMake", "CMake", "bin", "cmake.exe")))
            };
            var result = methods.Select(x =>
            {
                try
                {
                    return(x());
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception)
                {
                    return(null);
                }
#pragma warning restore CA1031 // Do not catch general exception types
            }).FirstOrDefault(x => x != null);

            if (result != null)
            {
                try
                {
                    result = Path.GetFullPath(result);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception)
                {
                    result = null;
                }
#pragma warning restore CA1031 // Do not catch general exception types
            }
            return(result);
        }
Example #2
0
 public static Task ScanKitsAsync()
 {
     VsInstances.GetAll(); //Init on main thread
     return(Task.Run(ScanKits));
 }