summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmVSSetupHelper.cxx23
-rw-r--r--Source/cmVSSetupHelper.h4
2 files changed, 13 insertions, 14 deletions
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index f1b22b9..d0932ba 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -54,9 +54,7 @@ const WCHAR* ComponentType = L"Component";
std::string VSInstanceInfo::GetInstallLocation() const
{
- std::string loc = cmsys::Encoding::ToNarrow(this->VSInstallLocation);
- cmSystemTools::ConvertToUnixSlashes(loc);
- return loc;
+ return this->VSInstallLocation;
}
cmVSSetupAPIHelper::cmVSSetupAPIHelper(unsigned int version)
@@ -161,7 +159,8 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
if (FAILED(pInstance->GetInstallationVersion(&bstrVersion))) {
return false;
} else {
- vsInstanceInfo.Version = std::wstring(bstrVersion);
+ vsInstanceInfo.Version =
+ cmsys::Encoding::ToNarrow(std::wstring(bstrVersion));
}
// Reboot may have been required before the installation path was created.
@@ -170,7 +169,9 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
if (FAILED(pInstance->GetInstallationPath(&bstrInstallationPath))) {
return false;
} else {
- vsInstanceInfo.VSInstallLocation = std::wstring(bstrInstallationPath);
+ vsInstanceInfo.VSInstallLocation =
+ cmsys::Encoding::ToNarrow(std::wstring(bstrInstallationPath));
+ cmSystemTools::ConvertToUnixSlashes(vsInstanceInfo.VSInstallLocation);
}
}
@@ -251,7 +252,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceVersion(std::string& vsInstanceVersion)
bool isInstalled = this->EnumerateAndChooseVSInstance();
if (isInstalled) {
- vsInstanceVersion = cmsys::Encoding::ToNarrow(chosenInstanceInfo.Version);
+ vsInstanceVersion = chosenInstanceInfo.Version;
}
return isInstalled;
@@ -285,7 +286,7 @@ bool cmVSSetupAPIHelper::IsEWDKEnabled()
bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
{
bool isVSInstanceExists = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
+ if (chosenInstanceInfo.VSInstallLocation.compare("") != 0) {
return true;
}
@@ -298,10 +299,8 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
if (envVSVersion.empty() || envVsInstallDir.empty())
return false;
- chosenInstanceInfo.VSInstallLocation =
- std::wstring(envVsInstallDir.begin(), envVsInstallDir.end());
- chosenInstanceInfo.Version =
- std::wstring(envVSVersion.begin(), envVSVersion.end());
+ chosenInstanceInfo.VSInstallLocation = envVsInstallDir;
+ chosenInstanceInfo.Version = envVSVersion;
chosenInstanceInfo.VCToolsetVersion = envVSVersion;
chosenInstanceInfo.IsWin10SDKInstalled = true;
chosenInstanceInfo.IsWin81SDKInstalled = !envWindowsSdkDir81.empty();
@@ -329,7 +328,7 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
return false;
}
- std::wstring const wantVersion = std::to_wstring(this->Version) + L'.';
+ std::string const wantVersion = std::to_string(this->Version) + '.';
SmartCOMPtr<ISetupInstance> instance;
while (SUCCEEDED(enumInstances->Next(1, &instance, NULL)) && instance) {
diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h
index 5a7daa2..ad242a5 100644
--- a/Source/cmVSSetupHelper.h
+++ b/Source/cmVSSetupHelper.h
@@ -84,8 +84,8 @@ private:
struct VSInstanceInfo
{
- std::wstring VSInstallLocation;
- std::wstring Version;
+ std::string VSInstallLocation;
+ std::string Version;
std::string VCToolsetVersion;
bool IsWin10SDKInstalled = false;
bool IsWin81SDKInstalled = false;