Qt Installer Framework detached process problem
Unsolved
Qt Creator and other tools
-
I am trying to build an installer using Qt Framework Installer 4.2 where I need to remove some folders from C:/Program Files and C:/ProgramData. Referring to this I realized I need to pass arguments to detached process as a string list. Here is how my install script looks like:
function Component() { } Component.prototype.createOperations = function() { try { // call the base create operations function component.createOperations(); } catch (e) { console.log(e); } if (systemInfo.productType === "windows") { component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@StartMenuDir@/Desktop Application.lnk", "workingDirectory=@TargetDir@"); component.addOperation("CreateShortcut", "@TargetDir@/App.exe", "@HomeDir@/Desktop/Desktop Application.lnk"); if(installer.fileExists(somePathFile)) { installer.executeDetached("cmd", ["del", "C:/ProgramData/DesktopApp/Config/settings.json"], "@TargetDir@"); installer.executeDetached("cmd", ["/s", "rmdir", "C:/ProgramData/DesktopApp/Config"], "@TargetDir@"); } if(installer.fileExists(somePathFile)) { installer.executeDetached("cmd", ["del", "C:/ProgramData/DesktopApp/Logs/app_log.txt"], "@TargetDir@"); installer.executeDetached("cmd", ["del", "C:/ProgramData/DesktopApp/Logs/app_log.old.txt"], "@TargetDir@"); installer.executeDetached("cmd", ["/s", "rmdir", "C:/ProgramData/DesktopApp/Logs"], "@TargetDir@"); } installer.executeDetached("cmd", ["del", "@TargetDir@/Config/settings.json"], "@TargetDir@"); installer.executeDetached("cmd", ["/s", "rmdir", "@TargetDir@/Config"], "@TargetDir@"); installer.executeDetached("cmd", ["del", "@TargetDir@/Logs/app_log.txt"], "@TargetDir@"); installer.executeDetached("cmd", ["del", "@TargetDir@/Logs/app_log.old.txt"], "@TargetDir@"); installer.executeDetached("cmd", ["/s", "rmdir", "@TargetDir@/Logs"], "@TargetDir@"); } }
Running the installer successfully installs the program but none of the above commands perform. InstallationLog.txt looks like this:
run application as detached process: "cmd" ("del", "C:/ProgramData/DesktopApp/Config/settings.json") "C:/Program Files/DesktopApp"
Same output for the rest of the commands. It just doesn't delete anything.
using
component.addOperation("Execute", "...")
method freezes the whole installation. So, I thought I would rather stick toinstaller
object.