[Qbs] How to use 'qbs' in a JavaScript function?

Jochen Becher jochen_becher at gmx.de
Tue Sep 5 12:08:19 CEST 2023


Hi,

until qbs 1.9 the following works:

import qbs 1.0
import import 'utils.js' as Utils
Probe {
	id: workspaceRootDetector
	property path rootDir
	configure: {
		rootDir = Utils.detectWorkspaceRoot(qbs)
	}
}

Since qbs 2.0.2 (from QtCreator 10.0.2), I get the following error
message from calling Utils.detectWorkspaceRoot:

'qbs' is not defined

'qbs' is used within Utils.detectWorkspaceRoot to access some
properties from qbs, e.g., 

return qbs.targetOS.contains("windows") ? "D:/projects" : "/projects"

How can I achieve the same with qbs 2.0.2? I would like to use a
variant which works in older qbs Version also because older and newer
qbs will be  used in parallel for a while.

Regards, Jochen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20230905/9d20c79f/attachment.htm>


More information about the Qbs mailing list