summaryrefslogtreecommitdiff
path: root/share/qbs/imports/qbs/ModUtils/utils.js
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2015-07-23 14:39:19 -0700
committerJake Petroules <jake.petroules@petroules.com>2015-09-02 15:42:16 +0000
commit7069834085fdcaad1587c8f3fd1918cc4b168cdd (patch)
treed91d3c59e9c780c4232043e88b6aba367610f21b /share/qbs/imports/qbs/ModUtils/utils.js
parent09f2e967ceb2c1cb4c21822e9fce6ef3a0e819c8 (diff)
downloadqbs-7069834085fdcaad1587c8f3fd1918cc4b168cdd.tar.gz
Let Qbs build its own Windows ZIP distribution.
Change-Id: Id633922727fd715750547f4c27cac6f604abe28a Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'share/qbs/imports/qbs/ModUtils/utils.js')
-rw-r--r--share/qbs/imports/qbs/ModUtils/utils.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/share/qbs/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js
index 6498ade9b..61a43cc88 100644
--- a/share/qbs/imports/qbs/ModUtils/utils.js
+++ b/share/qbs/imports/qbs/ModUtils/utils.js
@@ -33,6 +33,22 @@ var FileInfo = loadExtension("qbs.FileInfo");
var Process = loadExtension("qbs.Process");
var TemporaryDir = loadExtension("qbs.TemporaryDir");
+function artifactInstalledFilePath(artifact, product) {
+ var relativeInstallDir = artifact.moduleProperty("qbs", "installDir");
+ var installPrefix = artifact.moduleProperty("qbs", "installPrefix");
+ var installSourceBase = artifact.moduleProperty("qbs", "installSourceBase");
+ var targetDir = FileInfo.joinPaths(artifact.moduleProperty("qbs", "installRoot"),
+ installPrefix, relativeInstallDir);
+ if (installSourceBase) {
+ if (!FileInfo.isAbsolutePath(installSourceBase))
+ throw "installSourceBase is not an absolute path";
+ if (!artifact.filePath.startsWith(installSourceBase))
+ throw "artifact file path doesn't start with the value of qbs.installSourceBase";
+ return FileInfo.joinPaths(targetDir, artifact.filePath.substr(installSourceBase.length + 1));
+ }
+ return FileInfo.joinPaths(targetDir, artifact.fileName);
+}
+
/**
* Given a list of file tags, returns the file tag (one of [c, cpp, objc, objcpp])
* corresponding to the C-family language the file should be compiled as.