aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/tools/vsenvironmentdetector.cpp
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-11-16 12:17:32 -0800
committerJake Petroules <jake.petroules@qt.io>2017-11-17 22:54:28 +0000
commit7cbe9c436ff9d657eb116b43a97600806645a139 (patch)
tree11c56d868806a27b2fc54d827480048fc9915417 /src/lib/corelib/tools/vsenvironmentdetector.cpp
parent6c712e48035b4871781a662b5ae235a2ba6f86bf (diff)
Provide more detailed error message when failing to find vcvarsall.bat
Change-Id: I171122d53e823277850abb4be05376d3fa528d85 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/tools/vsenvironmentdetector.cpp')
-rw-r--r--src/lib/corelib/tools/vsenvironmentdetector.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/lib/corelib/tools/vsenvironmentdetector.cpp b/src/lib/corelib/tools/vsenvironmentdetector.cpp
index c8a638130..16cdc3110 100644
--- a/src/lib/corelib/tools/vsenvironmentdetector.cpp
+++ b/src/lib/corelib/tools/vsenvironmentdetector.cpp
@@ -42,6 +42,7 @@
#include <logging/translator.h>
#include <tools/qbsassert.h>
#include <tools/qttools.h>
+#include <tools/stringutils.h>
#include <QtCore/qdebug.h>
#include <QtCore/qdir.h>
@@ -102,7 +103,8 @@ bool VsEnvironmentDetector::start(std::vector<MSVC *> msvcs)
return someMSVCDetected;
}
-QString VsEnvironmentDetector::findVcVarsAllBat(const MSVC &msvc) const
+QString VsEnvironmentDetector::findVcVarsAllBat(const MSVC &msvc,
+ std::vector<QString> &searchedPaths) const
{
// ### We can only rely on MSVC.vcInstallPath being set
// when this is called from utilitiesextension.cpp :-(
@@ -117,19 +119,32 @@ QString VsEnvironmentDetector::findVcVarsAllBat(const MSVC &msvc) const
}
const QString vcvarsallbat = QStringLiteral("vcvarsall.bat");
QString path = vcvarsallbat;
+ QString fullPath = dir.absoluteFilePath(path);
if (dir.exists(path))
- return dir.absoluteFilePath(path);
+ return fullPath;
+ else
+ searchedPaths.push_back(fullPath);
path = QLatin1String("Auxiliary/Build/") + vcvarsallbat;
+ fullPath = dir.absoluteFilePath(path);
if (dir.exists(path))
- return dir.absoluteFilePath(path);
+ return fullPath;
+ else
+ searchedPaths.push_back(fullPath);
return QString();
}
bool VsEnvironmentDetector::startDetection(const std::vector<MSVC *> &compatibleMSVCs)
{
- const QString vcvarsallbat = findVcVarsAllBat(**compatibleMSVCs.begin());
+ std::vector<QString> searchedPaths;
+ const QString vcvarsallbat = findVcVarsAllBat(**compatibleMSVCs.begin(), searchedPaths);
if (vcvarsallbat.isEmpty()) {
- m_errorString = Tr::tr("Cannot find 'vcvarsall.bat'.");
+ if (!searchedPaths.empty()) {
+ m_errorString = Tr::tr(
+ "Cannot find 'vcvarsall.bat' at any of the following locations:\n\t")
+ + join(searchedPaths, QStringLiteral("\n\t"));
+ } else {
+ m_errorString = Tr::tr("Cannot find 'vcvarsall.bat'.");
+ }
return false;
}