From a5d801e02c284da024ee91f8b1a122f490db7f75 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 19 Jul 2017 22:02:59 -0700 Subject: Avoid hardcoded paths to the Windows system drive/root and shell path Change-Id: Ib85025466b885734a607294245c63d7e361cc20b Reviewed-by: Kai Koehne Reviewed-by: Joerg Bornemann --- share/qbs/modules/qnx/qnx.qbs | 2 +- tests/auto/api/testdata/codegen/codegen.qbs | 4 ++-- tests/auto/blackbox/testdata/jsextensions-process/process.qbs | 4 +++- tests/manual/configure/modules/definition/module.qbs | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/share/qbs/modules/qnx/qnx.qbs b/share/qbs/modules/qnx/qnx.qbs index 8eb952290..49ebc36b6 100644 --- a/share/qbs/modules/qnx/qnx.qbs +++ b/share/qbs/modules/qnx/qnx.qbs @@ -41,7 +41,7 @@ Module { id: qnxSdkProbe names: ["qnx700", "qnx660", "qnx650"] pathPrefixes: qbs.hostOS.contains("windows") - ? [Environment.getEnv("USERPROFILE"), "C:/"] + ? [Environment.getEnv("USERPROFILE"), Environment.getEnv("SystemDrive")] : [Environment.getEnv("HOME"), "/opt"] } diff --git a/tests/auto/api/testdata/codegen/codegen.qbs b/tests/auto/api/testdata/codegen/codegen.qbs index 282ee4a7f..8314a4132 100644 --- a/tests/auto/api/testdata/codegen/codegen.qbs +++ b/tests/auto/api/testdata/codegen/codegen.qbs @@ -58,12 +58,12 @@ Project { var args = ['echo ' + code + '>' + output.filePath] var cmd if (product.moduleProperty("qbs", "hostOS").contains('windows')) { - cmd = new Command('cmd.exe', ['/C'].concat(args)); + cmd = new Command(product.qbs.windowsShellPath, ['/C'].concat(args)); } else { args[0] = args[0].replace(/\(/g, '\\(') args[0] = args[0].replace(/\)/g, '\\)') args[0] = args[0].replace(/;/g, '\\;') - cmd = new Command('/bin/sh', ['-c'].concat(args)) + cmd = new Command(product.qbs.shellPath, ['-c'].concat(args)) } cmd.description = 'generate\t' + FileInfo.fileName(output.filePath); cmd.highlight = 'codegen'; diff --git a/tests/auto/blackbox/testdata/jsextensions-process/process.qbs b/tests/auto/blackbox/testdata/jsextensions-process/process.qbs index dc8c8c669..c9c832ba4 100644 --- a/tests/auto/blackbox/testdata/jsextensions-process/process.qbs +++ b/tests/auto/blackbox/testdata/jsextensions-process/process.qbs @@ -1,4 +1,5 @@ import qbs +import qbs.Environment import qbs.FileInfo import qbs.Process import qbs.TextFile @@ -52,7 +53,8 @@ Project { // closeWriteChannel test process = new Process(); if (product.qbs.hostOS.contains("windows")) - process.start("cmd", ["/C", "c:\\windows\\system32\\sort.exe"]); + process.start(product.qbs.windowsShellPath, + ["/C", product.qbs.windowsSystemRoot + "\\system32\\sort.exe"]); else process.start("cat", []); process.writeLine("should be"); diff --git a/tests/manual/configure/modules/definition/module.qbs b/tests/manual/configure/modules/definition/module.qbs index 3e3509e20..60f442149 100644 --- a/tests/manual/configure/modules/definition/module.qbs +++ b/tests/manual/configure/modules/definition/module.qbs @@ -11,7 +11,7 @@ Module { var cmd; var args; if (qbs.targetOS.contains("windows")) { - cmd = "cmd"; + cmd = qbs.windowsShellPath; args = ["/c", "date", "/t"]; } else { cmd = 'date'; -- cgit v1.2.3