Commit 4c3116d7 authored by Brad King's avatar Brad King
Browse files

cmVSSetupHelper: Factor out install location string construction

This also adds a missing conversion to unix slashes in one code path.
parent a91eb5e4
...@@ -49,6 +49,14 @@ const WCHAR* Win81SDKComponent = ...@@ -49,6 +49,14 @@ const WCHAR* Win81SDKComponent =
L"Microsoft.VisualStudio.Component.Windows81SDK"; L"Microsoft.VisualStudio.Component.Windows81SDK";
const WCHAR* ComponentType = L"Component"; const WCHAR* ComponentType = L"Component";
std::string VSInstanceInfo::GetInstallLocation() const
{
std::string loc(this->VSInstallLocation.begin(),
this->VSInstallLocation.end());
cmSystemTools::ConvertToUnixSlashes(loc);
return loc;
}
cmVSSetupAPIHelper::cmVSSetupAPIHelper() cmVSSetupAPIHelper::cmVSSetupAPIHelper()
: setupConfig(NULL) : setupConfig(NULL)
, setupConfig2(NULL) , setupConfig2(NULL)
...@@ -222,9 +230,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation) ...@@ -222,9 +230,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
bool isInstalled = this->EnumerateAndChooseVSInstance(); bool isInstalled = this->EnumerateAndChooseVSInstance();
if (isInstalled) { if (isInstalled) {
std::string str(chosenInstanceInfo.VSInstallLocation.begin(), vsInstallLocation = chosenInstanceInfo.GetInstallLocation();
chosenInstanceInfo.VSInstallLocation.end());
vsInstallLocation = str;
} }
return isInstalled; return isInstalled;
...@@ -281,9 +287,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() ...@@ -281,9 +287,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
if (isInstalled) { if (isInstalled) {
if (!envVSCommonToolsDir.empty()) { if (!envVSCommonToolsDir.empty()) {
std::string currentVSLocation(instanceInfo.VSInstallLocation.begin(), std::string currentVSLocation = instanceInfo.GetInstallLocation();
instanceInfo.VSInstallLocation.end());
cmSystemTools::ConvertToUnixSlashes(currentVSLocation);
currentVSLocation += "/Common7/Tools"; currentVSLocation += "/Common7/Tools";
if (cmSystemTools::ComparePath(currentVSLocation, if (cmSystemTools::ComparePath(currentVSLocation,
envVSCommonToolsDir)) { envVSCommonToolsDir)) {
......
...@@ -116,6 +116,8 @@ struct VSInstanceInfo ...@@ -116,6 +116,8 @@ struct VSInstanceInfo
ullVersion = 0; ullVersion = 0;
IsWin10SDKInstalled = IsWin81SDKInstalled = false; IsWin10SDKInstalled = IsWin81SDKInstalled = false;
} }
std::string GetInstallLocation() const;
}; };
class cmVSSetupAPIHelper class cmVSSetupAPIHelper
......
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