------------------------------------------------------------------------ -
| 76 | |
| 77 | //------------------------------------------------------------------------ - |
| 78 | fs::path GetVisualStudioPath() |
| 79 | { |
| 80 | fs::path programFileX86 = std::getenv("ProgramFiles(x86)"); |
| 81 | auto vswhere = programFileX86 / "Microsoft Visual Studio" / |
| 82 | "Installer" / "vswhere.exe"; |
| 83 | |
| 84 | std::vector<std::string> args = { |
| 85 | "-latest", "-format", "value", "-property", "installationPath"}; |
| 86 | std::string value = RunProcess(vswhere, args); |
| 87 | boost::trim(value); |
| 88 | fs::path installerPath{value}; |
| 89 | |
| 90 | if (!Tools::FileExists(installerPath)) |
| 91 | throw std::runtime_error( |
| 92 | "Invalid Visual Studio installation path: " + value); |
| 93 | return installerPath; |
| 94 | } |
| 95 | } |