MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / GetVisualStudioPath

Function GetVisualStudioPath

TestHelper/Tools.cpp:78–94  ·  view source on GitHub ↗

------------------------------------------------------------------------ -

Source from the content-addressed store, hash-verified

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}

Callers 2

GetDumpBinPathFunction · 0.85
TESTFunction · 0.85

Calls 2

RunProcessFunction · 0.85
FileExistsFunction · 0.85

Tested by 2

GetDumpBinPathFunction · 0.68
TESTFunction · 0.68