I use Qt Installer framework 1.5
After the installation, I would like to add a shortcut on the desktop.
In my file installscript.qs, I tried :
Component.prototype.createOperationsForPath = function()
{
if (installer.value("os") === "win")
{
try {
component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@DesktopDir@/App.lnk");
}
catch (e) {
print(e);
}
}
}
But it doesn't work, the shortcut isn't created and I don't have any error messages. The documentation on Internet is really light.
Any idea ? Thank you
Try this. It's working for me.
Component.prototype.createOperations = function()
{
try {
// call the base create operations function
component.createOperations();
if (installer.value("os") == "win") {
try {
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
component.addOperation("CreateShortcut", "@TargetDir@\\MiamPlayer.exe", "@UserProfile@\\Desktop\\MiamPlayer.lnk");
} catch (e) {
// Do nothing if key doesn't exist
}
}
} catch (e) {
print(e);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With