Reputation: 193
Using QtIFW-1.5.0, so far I'm able to generate an online installer for my Qt application on Windows. The installer downloads the appropriate package from my web server and performs some operations defined in the control script installscript.qs, e.g. writing some keys into registry and creating a desktop shortcut with an icon:
installscript.qs:
Component.prototype.createOperations = function()
{
try
{
// call the base create operations function
component.createOperations();
// Add some keys to registry;
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
var key= "HKCU\\Software\\Company\\Product";
component.addOperation("Execute", reg, "ADD", key, "/f");
component.addOperation("Execute", reg, "ADD", key, "/v", "productId", "/t", "REG_BINARY");
// Add a desktop shortcut with icon:
component.addOperation("CreateShortcut",
"@TargetDir@\\MyExecutable.exe",
"@UserProfile@\\Desktop\\MyExecutable.lnk",
"workingDirectory=@TargetDir@",
"iconPath=@TargetDir@\\MyIcon.ico");
}
catch (e)
{
print(e);
}
}
All right, but another key I need to write into registry is the package VERSION NUMBER, defined in the installer configuration file config.xml in tag
<Version></Version>
How can I get this value from installscript.qs ? I read --I'd said more: studied-- the docs component QML Type and installer QML Type and I have not found any reference to version, except:
installer QML type:
boolean versionMatches(string version, string requirement)
which is useless for me, because you have to know the version, which is precisely what I find.
So any help would be appreciated.
Upvotes: 1
Views: 1994
Reputation: 934
You can call
var version = installer.value("ProductVersion");
to get the version specified in the config.xml
file.
Upvotes: 1