Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 0362c60f authored by Brad King's avatar Brad King
Browse files

cmVSSetupHelper: Simplify use of EnumerateAndChooseVSInstance

This method short-circuits when an instance has already been chosen, so
avoid duplicating this check at call sites.
parent 577f721f
...@@ -73,44 +73,19 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper() ...@@ -73,44 +73,19 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper()
bool cmVSSetupAPIHelper::IsVS2017Installed() bool cmVSSetupAPIHelper::IsVS2017Installed()
{ {
bool ret = false; return this->EnumerateAndChooseVSInstance();
if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
ret = EnumerateAndChooseVSInstance();
} else {
ret = true;
}
return ret;
} }
bool cmVSSetupAPIHelper::IsWin10SDKInstalled() bool cmVSSetupAPIHelper::IsWin10SDKInstalled()
{ {
bool isWin10SDKInstalled = false; return (this->EnumerateAndChooseVSInstance() &&
if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) { chosenInstanceInfo.IsWin10SDKInstalled);
if (EnumerateAndChooseVSInstance() &&
chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled;
}
} else {
isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled;
}
return isWin10SDKInstalled;
} }
bool cmVSSetupAPIHelper::IsWin81SDKInstalled() bool cmVSSetupAPIHelper::IsWin81SDKInstalled()
{ {
bool isWin81SDKInstalled = false; return (this->EnumerateAndChooseVSInstance() &&
if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) { chosenInstanceInfo.IsWin81SDKInstalled);
if (EnumerateAndChooseVSInstance() &&
chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled;
}
} else {
isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled;
}
return isWin81SDKInstalled;
} }
bool cmVSSetupAPIHelper::CheckInstalledComponent( bool cmVSSetupAPIHelper::CheckInstalledComponent(
...@@ -243,18 +218,12 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo( ...@@ -243,18 +218,12 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation) bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
{ {
vsInstallLocation = ""; vsInstallLocation = "";
bool isInstalled = false; bool isInstalled = this->EnumerateAndChooseVSInstance();
if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
isInstalled = EnumerateAndChooseVSInstance();
}
// Enumerate and choose best VS instance if (isInstalled) {
if (chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
std::string str(chosenInstanceInfo.VSInstallLocation.begin(), std::string str(chosenInstanceInfo.VSInstallLocation.begin(),
chosenInstanceInfo.VSInstallLocation.end()); chosenInstanceInfo.VSInstallLocation.end());
vsInstallLocation = str; vsInstallLocation = str;
isInstalled = true;
} }
return isInstalled; return isInstalled;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment