aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-06-06 16:11:31 -0700
committerJake Petroules <jake.petroules@qt.io>2017-06-07 16:04:33 +0000
commit71d8c61c29c33693373d410dd9b30feea788d7bb (patch)
tree475ac3653b80e13339b7d6121c6ee227cf6f6a0c
parenta6353f994c017eeb64a6c242ab0382cf05583477 (diff)
PathProbe: provide candidate paths that were searched
These can be used in the construction of helpful error messages. Change-Id: I24d2871b362a035c0071b845c8e4ef119d023905 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/imports/qbs/Probes/NpmProbe.qbs1
-rw-r--r--share/qbs/imports/qbs/Probes/PathProbe.qbs2
-rw-r--r--share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs1
-rw-r--r--share/qbs/imports/qbs/Probes/path-probe.js27
4 files changed, 18 insertions, 13 deletions
diff --git a/share/qbs/imports/qbs/Probes/NpmProbe.qbs b/share/qbs/imports/qbs/Probes/NpmProbe.qbs
index efe26390e..d26e07eec 100644
--- a/share/qbs/imports/qbs/Probes/NpmProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/NpmProbe.qbs
@@ -49,6 +49,7 @@ NodeJsProbe {
result.npmPrefix = result.found ? NodeJs.findLocation(result.filePath, "prefix") : undefined;
found = result.found;
+ candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
diff --git a/share/qbs/imports/qbs/Probes/PathProbe.qbs b/share/qbs/imports/qbs/Probes/PathProbe.qbs
index 068fa03ff..9d5f1f287 100644
--- a/share/qbs/imports/qbs/Probes/PathProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/PathProbe.qbs
@@ -44,6 +44,7 @@ Probe {
property string pathListSeparator: qbs.pathListSeparator
// Output
+ property stringList candidatePaths
property string path
property string filePath
property string fileName
@@ -53,6 +54,7 @@ Probe {
pathSuffixes, platformPaths, environmentPaths,
platformEnvironmentPaths, pathListSeparator);
found = result.found;
+ candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
diff --git a/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs b/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs
index f8b773db8..3e6a6cebe 100644
--- a/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs
@@ -70,6 +70,7 @@ BinaryProbe {
}
found = result.found;
+ candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
diff --git a/share/qbs/imports/qbs/Probes/path-probe.js b/share/qbs/imports/qbs/Probes/path-probe.js
index 0a0ccc772..bf30e8ec6 100644
--- a/share/qbs/imports/qbs/Probes/path-probe.js
+++ b/share/qbs/imports/qbs/Probes/path-probe.js
@@ -35,6 +35,7 @@ var ModUtils = require("qbs.ModUtils");
function configure(names, nameSuffixes, nameFilter, pathPrefixes, pathSuffixes, platformPaths,
environmentPaths, platformEnvironmentPaths, pathListSeparator) {
+ var result = { found: false, candidatePaths: [] };
if (!names)
throw '"names" must be specified';
var _names = ModUtils.concatAll(names);
@@ -59,24 +60,24 @@ function configure(names, nameSuffixes, nameFilter, pathPrefixes, pathSuffixes,
for (var j = 0; j < _paths.length; ++j) {
for (var k = 0; k < _suffixes.length; ++k) {
var _filePath = FileInfo.joinPaths(_paths[j], _suffixes[k], _names[i]);
+ result.candidatePaths.push(_filePath);
if (File.exists(_filePath)) {
- return {
- found: true,
- filePath: _filePath,
+ result.found = true;
+ result.filePath = _filePath;
- // Manually specify the path components that constitute _filePath rather
- // than using the FileInfo.path and FileInfo.fileName functions because we
- // want to break _filePath into its constituent parts based on the input
- // originally given by the user. For example, the FileInfo functions would
- // produce a different result if any of the items in the names property
- // contained more than a single path component.
- fileName: _names[i],
- path: FileInfo.joinPaths(_paths[j], _suffixes[k]),
- }
+ // Manually specify the path components that constitute _filePath rather
+ // than using the FileInfo.path and FileInfo.fileName functions because we
+ // want to break _filePath into its constituent parts based on the input
+ // originally given by the user. For example, the FileInfo functions would
+ // produce a different result if any of the items in the names property
+ // contained more than a single path component.
+ result.fileName = _names[i];
+ result.path = FileInfo.joinPaths(_paths[j], _suffixes[k]);
+ return result;
}
}
}
}
- return { found: false };
+ return result;
}