[Qt Installer Framework] Run a batch file during uninstallation
-
Ok, I found the correct file.
seems like I abandoned the shell script on deinstall and went directly to this entry
Component.prototype.createOperations = function() { ... component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp"); }
-
@akhi95 sure
listen to the uninstallationStarted signal, and connect a function to it. In that function call the script.
I use it to remove desktop (shortcut) icons on MacOS
function Component() { ... installer.uninstallationStarted.connect(onUninstallationStarted); } onUninstallationStarted = function() { var argList = ["@TargetDir@/myApp.app/Contents/MacOS/data/remove-alias.sh"]; installer.execute("sh",argList); }
-
@J-Hilk Thanks for the reply. Since an hour, I have been trying to make your code work for my batch script but I'm unable to do so. I'm doing something like this
function Component() { ... installer.uninstallationStarted.connect(onUninstallationStarted); } onUninstallationStarted = function() { var argList = ["@TargetDir@/test.bat"]; installer.execute("bat",argList); }
-
@akhi95
Sorry I'm not a "Qt Installer Framework" person, but what is yourinstaller.execute("bat", ...;
?bat
is no kind of Windows command. If you need something there I would have thought it would likely be one of the following:var argList = ["@TargetDir@/test.bat"]; installer.execute("cmd",argList); var argList = ["/c", "@TargetDir@/test.bat"]; installer.execute("cmd", argList); var argList = []; installer.execute("@TargetDir@/test.bat", argList);
? There ought be Google examples somewhere?
-
@akhi95
@JonB is correct you will probably want to call the commandpropt for that batch file.That said, I may have given you a faulty example. I copy pasted from one I have still on my PC and I struggle to get it to work.
But I have some google coordinates for you, that may also help:
I'll post again, if I manage my example to work as well, it's been over a year for me 🙈
-
Ok, I found the correct file.
seems like I abandoned the shell script on deinstall and went directly to this entry
Component.prototype.createOperations = function() { ... component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp"); }
-
@J-Hilk said in [Qt Installer Framework] Run a batch file during uninstallation:
Ok, I found the correct file.
seems like I abandoned the shell script on deinstall and went directly to this entry
Component.prototype.createOperations = function() { ... component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp"); }
This worked! Thanks a ton! Initially, I didn't notice the neat little trick you did by doing nothing in the Execute part.