Laureta
7th April 2015, 19:37
Hi all,
I posted this few hours ago in the Qt Tools forum (http://www.qtcentre.org/threads/62155-Qt-Installer-Framework-Reading-downloaded-package-version), but I think here, having more movement, I can get some help.
There seems to be very few folks using this tool (Qt Installer Framework), but I'll ask before migrating to a third party tool.
Using QtIFW-1.5.0, so far I am 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:
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 https://doc-snapshots.qt.io/qtifw-master/scripting-component.html and https://doc-snapshots.qt.io/qtifw-master/scripting-installer.html and I have not found any reference to version, except:
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.
I posted this few hours ago in the Qt Tools forum (http://www.qtcentre.org/threads/62155-Qt-Installer-Framework-Reading-downloaded-package-version), but I think here, having more movement, I can get some help.
There seems to be very few folks using this tool (Qt Installer Framework), but I'll ask before migrating to a third party tool.
Using QtIFW-1.5.0, so far I am 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:
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 https://doc-snapshots.qt.io/qtifw-master/scripting-component.html and https://doc-snapshots.qt.io/qtifw-master/scripting-installer.html and I have not found any reference to version, except:
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.