adutzu89
10th December 2016, 18:20
I'm trying to create a desktop entry using a script file with the installer framework but not working.
Here is the content of the script file:
function Component() {
installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
}
Component.prototype.createOperations = function() {
component.createOperations();
}
Component.prototype.installationFinished = function() {
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
component.addOperation("CreateDesktopEntry",
"@HomeDir@/.local/share/applications/Cumulus.desktop",
"Type=Application\n
Terminal=false\n
Exec=@TargetDir@/Cumulus\n
Name=Cumulus\n
Icon=@TargetDir@/cumulus.svg");
component.addOperation("Copy", "@HomeDir@/.local/share/applications/Cumulus.desktop", "@HomeDir@/Desktop/Cumulus.desktop");
QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
}
} catch(e) {
console.log(e);
}
}
I also have tried the following version for installation Finished:
Component.prototype.installationFinished = function() {
var targetDir = installer.value("TargetDir");
var homeDir = installer.value("HomeDir");
var desktopFileTarget = installer.value("HomeDir") + "/.local/share/applications";
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
component.addOperation("CreateDesktopEntry",
desktopFileTarget + "/Cumulus.desktop",
"Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
}
} catch(e) {
console.log(e);
}
}
The script runs and no error is logged, when finishing the InstallationLog.txt opens and is there to confirm that the script is running.
I have also tried copying a file from within installation using Copy operation but not working at all either.
Here is the content of the script file:
function Component() {
installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
}
Component.prototype.createOperations = function() {
component.createOperations();
}
Component.prototype.installationFinished = function() {
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
component.addOperation("CreateDesktopEntry",
"@HomeDir@/.local/share/applications/Cumulus.desktop",
"Type=Application\n
Terminal=false\n
Exec=@TargetDir@/Cumulus\n
Name=Cumulus\n
Icon=@TargetDir@/cumulus.svg");
component.addOperation("Copy", "@HomeDir@/.local/share/applications/Cumulus.desktop", "@HomeDir@/Desktop/Cumulus.desktop");
QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
}
} catch(e) {
console.log(e);
}
}
I also have tried the following version for installation Finished:
Component.prototype.installationFinished = function() {
var targetDir = installer.value("TargetDir");
var homeDir = installer.value("HomeDir");
var desktopFileTarget = installer.value("HomeDir") + "/.local/share/applications";
try {
if (installer.isInstaller() && installer.status == QInstaller.Success) {
component.addOperation("CreateDesktopEntry",
desktopFileTarget + "/Cumulus.desktop",
"Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + "/InstallationLog.txt");
}
} catch(e) {
console.log(e);
}
}
The script runs and no error is logged, when finishing the InstallationLog.txt opens and is there to confirm that the script is running.
I have also tried copying a file from within installation using Copy operation but not working at all either.