Installer framework CreateDesktopEntry help
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:
Code:
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:
Code:
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.
Re: Installer framework CreateDesktopEntry help
I don't have any know-how on the installer framework, but have you tried a tmp path for the target to see if it could be a path problem?
Cheers,
_
P.S.: $HOME/.local/share is the fallback default value if $XDG_DATA_HOME is not set, so you could end up with a wrong path on systems where that is set to something else
Re: Installer framework CreateDesktopEntry help
Hi anda,
I don't understand what you mean by tmp path, you mean an absolute path for the desktop entry? I have tried that.
I also tried other operations, if it's not written correctly I get errors otherwise it doesn't fire.......I don't understand what's happening :|
Added after 15 minutes:
Appearently Qt Installer Framework doesn't do operations after finish button was clicked.........
I have modified my script this way:
Code:
function Component() {}
Component.prototype.createOperations = function() {
component.createOperations();
var targetDir = installer.value("TargetDir");
var homeDir = installer.value("HomeDir");
var desktopFileTarget = installer.value("HomeDir") + "/.local/share/applications";
component.addOperation("CreateDesktopEntry",
"Cumulus.desktop",
"Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
component.addOperation("CreateDesktopEntry",
homeDir + "/.config/autostart/Cumulus.desktop",
"Type=Application\nTerminal=false\nExec= " + targetDir + "/Cumulus\nName=Cumulus\nIcon= " + targetDir + "/cumulus.svg");
}
Makes both Dash entry and autostart on login.
Re: Installer framework CreateDesktopEntry help
Quote:
Originally Posted by
adutzu89
Hi anda,
I don't understand what you mean by tmp path, you mean an absolute path for the desktop entry?
Yes, a fixed path, probably in the system temp directory. Something you know exists and is user writable.
Cheers,
_